3v4l.org

run code in 300+ PHP versions simultaneously
<?php spl_autoload_register(function($class) { if ($class === 'A') { class A { public function foo($x): B { return new B; } } } else if ($class === 'B') { class B extends A { public function foo($x): C { return new C; } } var_dump(new B); } else if ($class === 'C') { class C extends B implements N { } } }); new C;
Output for git.master, git.master_jit, rfc.property-hooks
object(B)#2 (0) { } Fatal error: During inheritance of C with variance dependencies: Uncaught Error: Interface "N" not found in /in/oUoG2:18 Stack trace: #0 /in/oUoG2(23): {closure}('C') #1 {main} in /in/oUoG2 on line 18
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:
104.56 ms | 1528 KiB | 4 Q