"Derek Battams" <de***@stopspam .battams.ca> wrote in message
news:%p******** ***********@hyd ra.nntpserver.c om...
True, but then I have to rely on PHP cleaning up resources in exactly
the same order each and every time. I went looking through the PHP docs
to see if the order of resource cleanup is guaranteed, but I don't see
any documentation saying that it is. My testing does show that in PHP
5.0.1 on Linux that opened files are closed after object destruction,
but is this always going to be the case? Also, I don't like leaving
resource cleanup to be implicitly done by the PHP engine, unless I can
find docs that promise the order in which it will be done.
"Resources are a special kind of data type in PHP. The term resources
doesn't really refer to any special kind of data, but to an abstraction
method for maintaining any kind of information. Resources are kept in a
special resource list within Zend. Each entry in the list has a
correspondendin g type definition that denotes the kind of resource to which
it refers. Zend then internally manages all references to this resource.
Access to a resource is never possible directly - only via a provided API.
As soon as all references to a specific resource are lost, a corresponding
shutdown function is called."
Hence the answer is yes, resources will be destroyed in the correct order.