3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function sum(int ...$numbers): int { $acc = 0; foreach ($numbers as $n) { $acc += $n; } return $acc; } echo sum(1, 2, 3, 4);
Output for 7.0.30 - 7.3.1
10
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Parameter $numbers is variadic and has a type constraint (HH\int); variadic params with type constraints are not supported in non-Hack files in /in/t3p76:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Parameter $numbers is variadic and has a type constraint (HH\int); variadic params with type constraints are not supported in non-Hack files in /in/t3p76:4 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.30
Warning: Unsupported declare 'strict_types' in /in/t3p76 on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/t3p76 on line 4
Process exited with code 255.