PHP: Getting reference ID
<p>How do I get the PHP reference ID, as is possible with the <code>var_dump</code> function:</p>

<pre><code>// PHP 5.2.6
class Test {}

$test1 = new Test; var_dump($test1);
$test1b = $test1;  var_dump($test1b);
$test2 = new Test; var_dump($test2);
</code></pre>

<p>Resulting in:</p>

<pre><code>object(Test)#1 (0) {}
object(Test)#1 (0) {}
object(Test)#2 (0) {}
</code></pre>

<p><br/>
See, <code>var_dump</code> can tell which references are equal without a straight-up comparison, and it prints their reference ID <code>#1</code> and <code>#2</code>.  How do <em>I</em> access that reference ID?</p>
