after unserialize $a2->ref isn't any more a reference.
To save items for the next request, you must avoid references and save all objects of a class in an array. To get a PHP-reference you could write a function like: <?php function get_obj_by_ref($ref){
global $_array_where_objects_of_class_foo_are_stored; $r = &$_array_where_objects_of_class_foo_are_stored[$ref];
return $r;
} ?>
I am unhappy about this behavior of PHP. I does not watch like a feature ... ;)
gnuffo1 at gmail dot com (28-Aug-2010 10:07)
If you want to know the reference count of a particular variable, then here's a function that makes use of debug_zval_dump() to do so: