HAYCORN — 16 April 2011

spl_object_hash: what is it good for??

Is it possible to do anything useful with PHP’s spl_object_hash() function? It returns an identifier when passed an object, but:

  1. If the object is destroyed, the identifier can be re-used.
  2. If the object is changed, the identifier stays the same.

(In having these two properties, it seems as though the identifier is essentially equivalent to the address of the object in memory.) What on earth is this for?