3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth']; shuffle($data); $result = []; $item = array_shift($data); for($i=0; $i<count($data); $i++) { $result[] = [$item, $item=$data[$i]]; } $result[] = [$result[count($result-1), 1], $result[0][0]]; var_dump($result);
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected ',', expecting ']' in /in/mh7Qi on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/mh7Qi on line 3
Process exited with code 255.

preferences:
180.03 ms | 1395 KiB | 60 Q