3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B extends A {} class Foo { public function test(B $a) { var_dump(get_class($a)); } } class Bar extends Foo { public function test(A $a) { parent::test($a); } } (new Foo)->test(new A); (new Foo)->test(new B); (new Bar)->test(new A); (new Bar)->test(new B);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Foo::test(): Argument #1 ($a) must be of type B, A given, called in /in/dHDQt on line 16 and defined in /in/dHDQt:6 Stack trace: #0 /in/dHDQt(16): Foo->test(Object(A)) #1 {main} thrown in /in/dHDQt on line 6
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:
51.05 ms | 401 KiB | 8 Q