3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.