3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Parenthesis($string) { $opening = array('}' => '{', ']' => '[', ')' => '('); $parens = array(); foreach (str_split($string) as $char) { switch ($char) { case '{': case '[': case '(': $parens[] = $char; break; case '}': case ']': case ')': if (!count($parens) || array_pop($parens) != $opening[$char]) return false; break; default: break; } } return count($parens) === 0; } function check_balanced($string) { echo "$string is " . (Parenthesis($string) ? '' : 'not ') . "balanced\n"; } check_balanced("{([]){}()}"); check_balanced("{C{}[{[a]}RqhL]{y2}}"); check_balanced("{([]){]()}");
Output for git.master, git.master_jit, rfc.property-hooks
{([]){}()} is balanced {C{}[{[a]}RqhL]{y2}} is balanced {([]){]()} is not balanced

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:
118.19 ms | 405 KiB | 5 Q