3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function addToBoolFilter(array $boolFilter, array ...$elements) { var_dump($elements); } addToBoolFilter(["array1"], ['array2' => 'value2']); addToBoolFilter(["array1"], ['array2' => 'value2'], ['array3' => 'value3']);
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
array(1) { [0]=> array(1) { ["array2"]=> string(6) "value2" } } array(2) { [0]=> array(1) { ["array2"]=> string(6) "value2" } [1]=> array(1) { ["array3"]=> string(6) "value3" } }
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Parameter $elements is variadic and has a type constraint (array); variadic params with type constraints are not supported in non-Hack files in /in/DnkI3:3 Stack trace: #0 {main}
Process exited with code 255.