3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function xx(int $a, float $b) { print_r(func_get_args()); } } class B extends A { public function xx(int $b, float $a) { parent::xx(...func_get_args()); } } $a = new A(); $a->xx(1, 2); $a->xx(a: 1, b: 2); $b = new B(); $b->xx(1, 2); $b->xx(a: 1, b: 2);
Output for 8.1.23 - 8.1.34, 8.2.10 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [0] => 1 [1] => 2 ) Array ( [0] => 1 [1] => 2 ) Array ( [0] => 1 [1] => 2 ) Array ( [0] => 2 [1] => 1 )
Output for 7.3.0 - 7.3.24, 7.4.0 - 7.4.12
Parse error: syntax error, unexpected ':', expecting ')' in /in/X8omS on line 19
Process exited with code 255.
Output for 7.2.0 - 7.2.34
Parse error: syntax error, unexpected ':', expecting ',' or ')' in /in/X8omS on line 19
Process exited with code 255.

preferences:
91.38 ms | 1161 KiB | 4 Q