3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar ( int $a, int $b, int $c, int|string $d = 'IV' ) { echo $a . "\n"; echo $b . "\n"; echo $c . "\n"; echo $d . "\n"; } public function baz ( int|string $dd = 'IV', int $aa, int $bb, int $cc, ) { echo $aa . "\n"; echo $bb . "\n"; echo $cc . "\n"; echo $dd . "\n"; } } $Obj = new Foo(); $Obj->bar( c: 3, a: 1, b: 2 ); $Obj->baz( cc: 3, aa: 1, bb: 2 );
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Optional parameter $dd declared before required parameter $cc is implicitly treated as a required parameter in /in/NToiL on line 16 1 2 3 IV Fatal error: Uncaught ArgumentCountError: Foo::baz(): Argument #1 ($dd) not passed in /in/NToiL:16 Stack trace: #0 /in/NToiL(38): Foo->baz(NULL, 1, 2, 3) #1 {main} thrown in /in/NToiL on line 16
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:
48.31 ms | 406 KiB | 5 Q