note 102307 deleted from language.references.spot by danbrown
| From: | danbrown@php.net | Date: | Tue, 08 Feb 2011 12:25:36 +0000 |
| Subject: | note 102307 deleted from language.references.spot by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176768@lists.php.net to get a copy of this message | ||
Note Submitter: phpdoc-php at lorgenetwork dot com
----
Here is a simple function which checks for reference, and works with objects by the test I did. Have
now fully checked under PHP version 5.2+ and can confirm that it works for everything I could think
of, including objects.
<?php
function is_reference_to(&$a, &$b)
{
if ($a !== $b)
return false; //Important.
$temp = $a;
$a = ($a === null) ? "" : null;
$res = ($b === $a);
$a = $temp;
return $res;
}
?>