note 94060 deleted from function.spl-object-hash by googleguy
| From: | googleguy@php.net | Date: | Mon, 08 Oct 2012 04:11:31 +0000 |
| Subject: | note 94060 deleted from function.spl-object-hash by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191177@lists.php.net to get a copy of this message | ||
Note Submitter: test user
----
It is possible to mark objects with unique identity to establish required functionality:
<?php
if (!function_exists('spl_object_hash')) {
function spl_object_hash($object) {
if (!is_object($object)) {
trigger_error(__FUNCTION__ . "() expects parameter 1 to be object",
E_USER_WARNING);
return null;
}
if (!isset($object->__oid__))
$object->__oid__ = uniqid();
}
return $object->__oid__;
}
}
?>