Hi Rowan,

In order to get an object's id, I use a trick that works for now:
>> https://github.com/symfony/symfony/blob/2.6/src/Symfony/
>> Component/VarDumper/Cloner/VarCloner.php#L258-L282
>>
>
> This seems like a very elaborate piece of reverse engineering


Right, and I made the claim for this being a trick :)

Still: the exact value is not what I'm most interested in you're right (but
it provides rought information about the number of objects currently
allocated which might be useful sometimes).

The gain is displaying a shortest possible number. I could rehash you're
right, but then I'll have collisions. Both arguments (short+unique number)
are relevant when debugging/dumping.


https://github.com/symfony/symfony/tree/2.6/src/Symfony/Component/Debug/Resources/ext
>>
>
> The more interesting part of this is the refcount


That, plus the fact that it returns the value (instead of writing it to
php://output)
but other returned values are also important, especially zval_hash and
zval_isref that allow efficient tracking of hard references.

Regards,
Nicolas

Reply via email to