HAYCORN — 16 April 2011

spl_object_hash: what is it good for??

Is it pos­si­ble to do any­thing useful with PHP’s spl_object_hash() function? It returns an iden­ti­fier when passed an object, but:

  1. If the object is destroyed, the iden­ti­fier can be re-used.
  2. If the object is changed, the iden­ti­fier stays the same.

(In having these two properties, it seems as though the iden­ti­fier is es­sen­tially equiv­a­lent to the address of the object in memory.) What on earth is this for?