3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class Foo { /** * @param int $i * @return void */ public function bar($i) {} public function baz(int $i): void {} } /** * @method string bar(bool $b, object $o) * @method string baz(bool $b, object $o) */ class Woo extends Foo {} $w = new Woo(); $r1 = $w->bar(true, new \stdClass); $r2 = $w->baz(true, new \stdClass); //$r3 = $w->bar(123); //$r4 = $w->baz(123); function test(float $f) {}; test($r1); test($r2); //test($r3); //test($r4);
Output for git.master, git.master_jit
Fatal error: Uncaught TypeError: Foo::baz(): Argument #1 ($i) must be of type int, bool given, called in /in/a45q7 on line 20 and defined in /in/a45q7:9 Stack trace: #0 /in/a45q7(20): Foo->baz(true, Object(stdClass)) #1 {main} thrown in /in/a45q7 on line 9
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught TypeError: Foo::baz(): Argument #1 ($i) must be of type int, true given, called in /in/a45q7 on line 20 and defined in /in/a45q7:9 Stack trace: #0 /in/a45q7(20): Foo->baz(true, Object(stdClass)) #1 {main} thrown in /in/a45q7 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:
27.54 ms | 407 KiB | 5 Q