3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'abc'; $file = ['abc', 'cba', 'bac', 'dac', 'ebcda']; $sortedInput = sort(explode('', $input)); foreach ($file as $item) { $sortedItem = explode('', $item) if ($sortedItem == $sortedInput) { echo "$item\n"; } }
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'if' (T_IF) in /in/Qnkrl on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/Qnkrl on line 4
Process exited with code 255.

preferences:
185.3 ms | 1395 KiB | 64 Q