3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<EOD [a-1]****************** [b-2]********** [c-3]*** EOD; preg_match_all('/^\[([a-z]-\d)](.*?)$/m' , $text, $matches, PREG_SET_ORDER); $result = array(); foreach ($matches as $match) { ____$result[$match[1]] = $match[2]; } var_dump($result);
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '$result' (T_VARIABLE) in /in/4UKDG on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/4UKDG on line 12
Process exited with code 255.

preferences:
178.51 ms | 1386 KiB | 55 Q