3v4l.org

run code in 200+ php & hhvm versions
<?php $array = array( 0 => 'val', 2 => 'val', 3 => 'val', 5 => 'val', 7 => 'val' ); $array = [...$array]; var_export($array);
based on ST6kG
Output for 7.4.0alpha1 - 7.4.0beta1
array ( 0 => 'val', 1 => 'val', 2 => 'val', 3 => 'val', 4 => 'val', )
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.3.7
Parse error: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']' in /in/qeVnW on line 10
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: syntax error, unexpected ..., expecting ']' in /in/qeVnW:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.3
Fatal error: Uncaught Error: syntax error, unexpected ..., expecting ']' in /in/qeVnW:10 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: syntax error, unexpected ..., expecting ']' in /in/qeVnW on line 10
Process exited with code 255.
Output for 5.4.0 - 5.5.38
Parse error: syntax error, unexpected '.', expecting ']' in /in/qeVnW on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/qeVnW on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/qeVnW on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/qeVnW on line 10
Process exited with code 255.