3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL|E_STRICT); class Foo {} class Hoge { public function aaa(Foo $foo) { echo 'hoge: ' . PHP_EOL; var_dump($foo); } } class Bar extends Hoge { public function aaa(Foo $foo = null) { echo 'foo: ' . PHP_EOL; var_dump($foo); } } $hoge = new Hoge(); $hoge->aaa(null); $bar = new Bar(); $bar->aaa(new Foo());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Hoge::aaa(): Argument #1 ($foo) must be of type Foo, null given, called in /in/cGhoD on line 26 and defined in /in/cGhoD:9 Stack trace: #0 /in/cGhoD(26): Hoge->aaa(NULL) #1 {main} thrown in /in/cGhoD on line 9
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:
59.11 ms | 401 KiB | 8 Q