3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = [ 3 => 15, 7 => 17, ]; $bar = function(int ...$baz) { var_dump($baz); }; var_dump($foo); $bar(...$foo);
based on mimND
Output for 7.0.0 - 7.3.1
array(2) { [3]=> int(15) [7]=> int(17) } array(2) { [0]=> int(15) [1]=> int(17) }
Output for hhvm-3.18.4 - 3.21.0
Fatal error: Uncaught Error: Parameter $baz is variadic and has a type constraint (HH\int); variadic params with type constraints are not supported in non-Hack files in /in/t1udq:8 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
array(2) { [3]=> int(15) [7]=> int(17) } Catchable fatal error: Argument 1 passed to {closure}() must be an instance of int, integer given, called in /in/t1udq on line 13 and defined in /in/t1udq on line 8
Process exited with code 255.