/* create the two entities */
$a = new ObjA;
$b = new ObjB;

/* create the circular reference between them */
$a->b = $b;
$b->a = $a;

/* Decrement refcount of both entities */
unset($a, $b);

/* Force PHP to clean the circular reference */
$cleaned = gc_collect_cycles();

/* Display how many zvals have been freed by
the circular reference garbage collector */

echo $cleaned; /* 2 */