@ 2020-10-16T21:44:27Z <?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);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.23 - 8.1.28 , 8.2.10 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Array
(
[0] => 1
[1] => 2
)
Array
(
[0] => 1
[1] => 2
)
Array
(
[0] => 1
[1] => 2
)
Array
(
[0] => 2
[1] => 1
)
Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
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:dark mode live preview
102.23 ms | 401 KiB | 100 Q