The follow function is a implementation of the PHP´s function spl_object_hash(), unavailable in versions less 5.2.0.
But, the algorithm of this function is different of the original PHP´s function.
(Sorry... my english is very bad...)
<?php
if (!function_exists('spl_object_hash')) {
function spl_object_hash($object)
{
if (is_object($object)) {
ob_start(); var_dump($object); $dump = ob_get_contents(); ob_end_clean();
if (preg_match('/^object\(([a-z0-9_]+)\)\#(\d)+/i', $dump, $match)) {
return md5($match[1] . $match[2]);
}
}
trigger_error(__FUNCTION__ . "() expects parameter 1 to be object", E_USER_WARNING);
return null;
}
}
?>