3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $v = "Not destructed"; public static $something = 0; public function __destruct() { print "A destructed\n"; $this->v = "descructed"; $this->x = new B(); A::$something++; B::$something++; C::$something++; } } class B { public $v = "Not destructed"; public static $something = 0; public function __destruct() { print "B destructed\n"; $this->v = "descructed"; $this->x = new C(); A::$something++; B::$something++; C::$something++; } } class C { public $v = "Not destructed"; public static $something = 0; public function __destruct() { print "C destructed\n"; $this->v = "descructed"; $this->x = new A(); A::$something++; B::$something++; C::$something++; } } function use_some_memory() { $a = "paul tarjan "; $as = []; $bs = []; $cs = []; while (count($as) < 10) { $a .= $a; $as[] = new A(); $bs[] = new B(); $cs[] = new C(); } // deliberate_OOM(); } function deliberate_OOM() { $a = "paul tarjan "; $as = []; $bs = []; $cs = []; while (true) { $a .= $a; $as[] = new A(); $bs[] = new B(); $cs[] = new C(); } } function on_shutdown() { print "A::something =" . A::$something . "\n"; print "B::something =" . B::$something . "\n"; print "C::something =" . C::$something . "\n"; } register_shutdown_function(on_shutdown); $a = new A(); $b = new B(); $c = new C(); use_some_memory();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "on_shutdown" in /in/T5N62:76 Stack trace: #0 {main} thrown in /in/T5N62 on line 76
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.58 ms | 401 KiB | 8 Q