> So, yes, just to make it more human friendly. In which case, the actual
> value doesn't matter, and rather than reverse-engineering the hash, you
> could just make up your own ID:
>
> function my_object_id($obj) {
>     static $hash_to_id=[];
>     $hash = spl_object_hash($obj);
>     if ( ! array_key_exists($hash, $hash_to_id) ) {
>         $hash_to_id[$hash] = count( $hash_to_id);
>     }
>     return $hash_to_id[$hash];
> }
>


Yep, that would work, but with the following drawbacks:
- it would create a memory leak/overhead
- more importantly for users, these ids couldn't be compared to var_dumps'.

Reply via email to