3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace funcs { function int(int ...$ints) {} declare(int, 'funcs\int'); } namespace { function sum(array $ints): int { (funcs\int)(...$ints); return array_sum($ints); } var_dump(sum([1, 2, 3])); var_dump(sum([1, 2, "three"])); }
Output for 7.1.0 - 7.1.17, 7.2.0 - 7.2.6
Parse error: syntax error, unexpected ',', expecting '=' in /in/EtQhP on line 8
Process exited with code 255.

preferences:
186.99 ms | 1395 KiB | 32 Q