3v4l.org

run code in 500+ 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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2BrI6
function name:  (null)
number of ops:  9
compiled vars:  !0 = $ss
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                                'pattern', '%23%5C%7B%28%3F%3A%28%3F%3Cname%3E%5Cw%2B%29%29%28%3F%3A%2F%5C%7D%7C%5C%7D%28%3F%3Csnippet%3E%28%3F%3A%5B%5E%7B%5D%2A%7C%28%3F%21%5C%7B%5Cw%2B%3A%5C%7D%29%7C%28%3FR%29%29%2A%29%5C%7Bend%5C%7D%29%23mu'
    5     1        ASSIGN                                                       !0, '%7Bfirst%7D+%7Bsecond%7Dwithin+second%7Bend%7D+%7Bend%7D'
   14     2        INIT_FCALL                                                   'preg_replace_callback'
          3        FETCH_CONSTANT                                       ~2      'pattern'
          4        SEND_VAL                                                     ~2
          5        SEND_VAL                                                     'testRun'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function testrun:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2BrI6
function name:  testRun
number of ops:  5
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        FETCH_DIM_R                                          ~1      !0, 0
          2        ECHO                                                         ~1
   11     3        ECHO                                                         '%0A'
   12     4      > RETURN                                                       null

End of function testrun

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.94 ms | 2297 KiB | 14 Q