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.

It's more complicated than that. Basically what uniquely identifies the object is the tuple (handlers, ID) - it's more or less by definition since handlers decide what to do with an object based on ID. Now, if we talk about "pure" PHP objects (i.e. made by regular PHP user-defined classes, no tricks) then the handlers would be the same and the ID is unique. However, extensions can produce their own handlers and their own IDs, and they don't even have to adhere to the concept that (class, ID) should uniquely identify the object. I don't know of extension that creates different handler sets for the same class, but there's nothing in the engine preventing anybody from doing that - though I'm not sure it's that good an idea. So (class, ID) would probably work now, but is not guaranteed to work. Just ID would have good chance to break with some extensions.

Yes, spl_object_hash uses the correct tuple - (handlers, ID).
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to