Special Resource type in PHP

Lecture



A resource is a special variable containing a link to an external resource. Resources are created and used by special functions. We provide a complete list of these functions and the corresponding resource types:

List of special functions and corresponding resource types ( page ~ 140 kb ).

List of special functions and corresponding types of resources ( zip - archive ~ 12 kb ).

Conversion to resource

Since a resource type contains special pointers to open files, connections to a database, an image area, and the like, you cannot convert any value to a resource.

Resource Release

In connection with the reference counting system introduced in the Zend PHP 4 engine, it is automatically determined that the resource is not referenced anywhere else (as in Java). When this happens, all the resources that were used for this resource are released by the garbage collector. For this reason, it is unlikely that it will ever be necessary to manually free memory using some kind of free_result function.

created: 2016-01-25
updated: 2021-03-13
132402



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)