3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP const pattern = "#\{(?:(?<name>\w+))(?:/\}|\}(?<snippet>(?:[^{]*|(?!\{\w+:\})|(?R))*)\{end\})#mu"; $ss = <<<'EOD' {first} {second}within second{end} {end} EOD; function testRun($input ){ echo $input[0]; echo PHP_EOL; } preg_replace_callback( pattern ,'testRun',$ss);

preferences:
24.31 ms | 404 KiB | 5 Q