3v4l.org

run code in 300+ PHP versions simultaneously
<?php function match($available, $opened, $closed) { $last_open = $opened[count($opened) - 1]; if ($available[$last_open] !== $closed[0]) { return 'NO'; } match($available, array_slice($opened, 0, -1), array_slice($closed, 1)); return 'YES'; } function isValid($braces) { $available = ['{' => '}', '(' => ')', '[' => ']']; $opened = []; $closed = []; for ($i = 0; $i < count($braces) - 1; $i++) { if (in_array($braces[$i], array_keys($available))) { $opened[] = $braces[$i]; continue; } $closed[] = $braces[$i]; } return match($available, $opened, $closed); } function braceCheck($values) { for ($i = 0; $i < count($values) - 1; $i++) { $braces = str_split($value); $values[$i] = isValid($braces); } return $values; } echo 'dessert\n'; $values = ['{}()[]', '{]}[']; var_dump($values); ?>
Output for git.master_jit, git.master, rfc.property-hooks
Parse error: syntax error, unexpected token "match", expecting "(" in /in/1uUpW on line 3
Process exited with code 255.

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