3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create($foo) { $bar = new stdClass; $foo->bar = $bar; $bar->foo = $foo; } gc_collect_cycles(); create(new stdClass()); var_dump(gc_collect_cycles()); // expected '2', actual '2' create((new ArrayObject())->setFlags(ArrayObject::STD_PROP_LIST)); var_dump(gc_collect_cycles()); // expected '2', actual '0'

preferences:
35.92 ms | 402 KiB | 5 Q