3v4l.org

run code in 300+ PHP versions simultaneously
<?php function grammar($description) { $g=array(); foreach(explode("\n",$description) as $line) { $sides = explode(" => ",$line); $lhs = $sides[0]; $rhs = $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 git.master, git.master_jit, rfc.property-hooks
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /in/co1P7 on line 11 Array ( [Exp] => Array ( [0] => Array ( [0] => Array ( [0] => ) [1] => Array ( [0] => ) ) ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.26 ms | 402 KiB | 8 Q