Someone said that BenBe's function is_ref() was broken for testing objects. I didn't test it but I rewrote it and I know it works for objects. Here is the new version :
<?php function is_ref(&$a, &$b){
if(gettype($a) !== gettype($b)) return false;
$same = false;
if(is_array($a)){
//Look for an unused index in $a $key = uniqid("is_ref_", true);
while(isset($a[$key]))$key = uniqid("is_ref_", true);
//The two variables differ in content ... They can't be the same if(isset($b[$key])) return