3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $x; } $x = new Foo(); $x->x = $x; // comment this line out $y = new WeakRef($x); unset($x); var_dump($y->get()); gc_collect_cycles(); var_dump($y->get());

preferences:
54.94 ms | 402 KiB | 5 Q