3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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"])); }
based on r7DKc
Output for 7.0.30 - 7.3.0alpha1
Parse error: syntax error, unexpected ',', expecting '=' in /in/EtQhP on line 8
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Parameter $ints is variadic and has a type constraint (HH\int); variadic params with type constraints are not supported in non-Hack files in /in/EtQhP:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Parameter $ints is variadic and has a type constraint (HH\int); variadic params with type constraints are not supported in non-Hack files in /in/EtQhP:6 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.30
Warning: Unsupported declare 'strict_types' in /in/EtQhP on line 2 Parse error: syntax error, unexpected ',', expecting '=' in /in/EtQhP on line 8
Process exited with code 255.