3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'if (blah === blah) do something', 'if (foo === foo) do something', 'if (bah === bah) { do something }', 'if (bar === bar) {do something}' ]; foreach ($strings as $string) { var_export(preg_match('~if\s*\(.*?\)\s*(\{)?~', $string, $m) ? $m : ''); echo "\nHas curly brace: " , isset($m[1]) ? 'Yes' : 'No'; echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'if (blah === blah) ', ) Has curly brace: No --- array ( 0 => 'if (foo === foo) ', ) Has curly brace: No --- array ( 0 => 'if (bah === bah) {', 1 => '{', ) Has curly brace: Yes --- array ( 0 => 'if (bar === bar) {', 1 => '{', ) Has curly brace: Yes ---

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:
151.46 ms | 406 KiB | 5 Q