PHP.nl

Resources

Resources

A is a special variable, holding a reference to an external resource. Resources are created and used by special functions. See the for a listing of all these functions and the corresponding types. resourceappendixresource

See also the function. get_resource_type

Converting to resource

As variables hold special handles to opened files, database connections, image canvas areas and the like, converting to a makes no sense. resource``resource

Freeing resources

Thanks to the reference-counting system being part of Zend Engine, a with no more references to it is detected automatically, and it is freed by the garbage collector. For this reason, it is rarely necessary to free the memory manually. resource

Opmerking: > Persistent database links are an exception to this rule. They are destroyed by the garbage collector. See the section for more information. notpersistent connections