@ 2019-07-18T09:34:08Z <?php
$array = array(
0 => 'val1',
2 => 'val2',
'A' => 'val3',
5 => 'val4',
7 => 'val5'
);
$array = [...$array];
var_export($array);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 , 8.4.1 - 8.4.12 array (
0 => 'val1',
1 => 'val2',
'A' => 'val3',
2 => 'val4',
3 => 'val5',
) Output for 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 Fatal error: Uncaught Error: Cannot unpack array with string keys in /in/2IgGh:10
Stack trace:
#0 {main}
thrown in /in/2IgGh on line 10
Process exited with code 255 . Output for 7.1.0 - 7.1.33 , 7.2.0 - 7.2.34 , 7.3.0 - 7.3.33 Parse error: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']' in /in/2IgGh on line 10
Process exited with code 255 . preferences:dark mode live preview ace vim emacs key bindings
78.77 ms | 409 KiB | 5 Q