3v4l.org

run code in 300+ PHP versions simultaneously
<?php function grammar(description) { $g=array(); foreach(explode("\n",$g) as $line) { $sides = explode(" => ",$line); $lhs = $sides[0]; $lhs = $sides[1]; $alternatives = explode($rhs,' | '); $g[$lhs] = array(array_map("explode",$alternatives,array(" "))); } return $g; } $des =<<<G Exp => Term [+-] Exp | Term G; print_r(grammar($des));
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected ')', expecting '&' or variable (T_VARIABLE) in /in/1fBYf on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /in/1fBYf on line 2
Process exited with code 255.

preferences:
178.56 ms | 1386 KiB | 47 Q