3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $v; public function __destruct() { echo "Hello there"; } } class B { public $v; public function __destruct() { echo " from the other side"; } } $a = new A(); $b = new B(); $a->v = $b; $b->v = $a; echo "Before exit\n"; exit(4);
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Before exit Hello there from the other side
Process exited with code 4.

preferences:
61.12 ms | 406 KiB | 5 Q