(accidentally didn't send this to the whole group at first) > Am I right in my guess that there's only a counter for each object > type? Still being not really unique this information could be very > useful and enough in many situations.
The "counter" is global, but it's not really a counter. "Object ids" are actually handles (basically indices) into an internal array holding data to all objects currently in memory. Handles are reused when an object is destroyed so that the array could be kept as small as possible. However, if you are comparing the handles of two objects that are known to be currently in memory, if they have the same handle, then they are the same object (i.e. one spot in memory). However, if you stored the handle of the object in another area of memory so that you can check it against other objects later, it's hard to ensure that the results of that comparison is meaningful. Therefore, it's better to use spl_object_hash to actually ensure objects are the same. Internally, the hash is performed on the object handle (what you've been calling the "object id") as well as the internal list of handlers for that object (basically the "type" of the object), so there's reasonable confidence that a unique hash will be generated. It looks like it's independent of the actual properties, etc. of the object. Spl_object_hash is what you guys want. David -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php