How do I get the PHP reference ID, as is possible with the var_dump
function:
// PHP 5.2.6
class Test {}
$test1 = new Test; var_dump($test1);
$test1b = $test1; var_dump($test1b);
$test2 = new Test; var_dump($test2);
Resulting in:
object(Test)#1 (0) {}
object(Test)#1 (0) {}
object(Test)#2 (0) {}
See, var_dump
can tell which references are equal without a straight-up comparison, and it prints their reference ID #1
and #2
. How do I access that reference ID?