<?php
$a = (object) array();
$b = (object) array();
function object_handle($obj)
{
static $mask = null;
if (null === $mask) {
$o = (object) array();
$h = hexdec(substr(spl_object_hash($o), 0, 16));
ob_start();
debug_zval_dump($o);
$mask = ob_get_clean();
$mask = $h ^ (int) substr($mask, 1 + strpos($mask, '#'));
}
return hexdec(substr(spl_object_hash($obj), 0, 16)) ^ $mask;
}
echo spl_object_hash($b), '-', object_handle($b), "\n";
echo spl_object_hash($a), '-', object_handle($a), "\n";
preferences:
37.03 ms | 402 KiB | 5 Q