Hi all.  I've been experimenting with creating data structures in PHP.  For
example I implemented a HashSet which turns out to have a higher
performance on larger sets than running in_array on arrays on add.

To do this I has to create a hash code generator which could hash scalar
types and objects.  Other arrays and resources are invalid in my experiment
for use as keys.

I'd like to request a feature alternative to spl_object_hash that can
safely hash any value save the two types I mentioned.

The issue with simply hashing a string to sha1 and sha1ing the result of
spl_object_hash is the possibility of collisions since a string can be
equal to the hash of an object.  This requires salting the values with
something defining their types, which is what I have done.

However my solution, although relatively fast, feels very unconventional,
and desires a natively supported option.

Thanks,
Dominic

Reply via email to