3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "foo { bar tree; bar ball/sand; snafu { string; } random { nested { value; bohica; } } }"; $buf = ""; $brace_level = 0; $words = array(); for ($i = 0; $i < strlen($text); $i++) { switch ($text[$i]) { case '{': $words[$brace_level] = trim($buf); $buf = ""; $brace_level++; break; case '}': unset($words[$brace_level]); $brace_level--; unset($words[$brace_level]); break; case ';': $words[$brace_level] = trim($buf); $buf = ""; ksort($words); print implode(" ", $words)."\n"; break; default: $buf .= $text[$i]; } }
Output for git.master, git.master_jit, rfc.property-hooks
foo bar tree foo bar ball/sand foo snafu string foo random nested value foo random nested bohica

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:
37.72 ms | 401 KiB | 8 Q