3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __destruct() { } } gc_disable(); $a1 = new A; $a2 = new A; $a1->ref = $a2; $a2->ref = $a1; $a1 = $a2 = NULL; echo 'removed cycles: '.gc_collect_cycles()."\n"; echo 'removed cycles: '.gc_collect_cycles()."\n";
Output for 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Deprecated: Creation of dynamic property A::$ref is deprecated in /in/0LIVn on line 12 Deprecated: Creation of dynamic property A::$ref is deprecated in /in/0LIVn on line 13 removed cycles: 2 removed cycles: 0
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 8.1.0 - 8.1.30
removed cycles: 2 removed cycles: 0
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
removed cycles: 0 removed cycles: 2

preferences:
68.94 ms | 412 KiB | 6 Q