3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { private function z($matches) { var_dump($matches); switch ($matches) { case 'cool': return 'wow'; case 'hey': return 'hehe'; } } public function y($template) { echo preg_replace_callback('/\[\[\s?([^\]]+)\s?\]/', [$this, 'z'], $template); } } $x = new X(); $x->y('bla bla [[ hey ]] dasfasdf [[ cool ]] werwr');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j5RuQ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'y'
          4        SEND_VAL_EX                                              'bla+bla+%5B%5B+hey+%5D%5D+dasfasdf+%5B%5B+cool+%5D%5D+werwr'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class X:
Function z:
Finding entry points
Branch analysis from position: 0
4 jumps found. (Code = 188) Position 1 = 10, Position 2 = 11, Position 3 = 12, Position 4 = 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 11
Branch analysis from position: 10
filename:       /in/j5RuQ
function name:  z
number of ops:  13
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    6     4      > SWITCH_STRING                                            !0, [ 'cool':->10, 'hey':->11, ], ->12
    7     5    >   IS_EQUAL                                                 !0, 'cool'
          6      > JMPNZ                                                    ~2, ->10
    9     7    >   IS_EQUAL                                                 !0, 'hey'
          8      > JMPNZ                                                    ~2, ->11
          9    > > JMP                                                      ->12
    8    10    > > RETURN                                                   'wow'
   10    11    > > RETURN                                                   'hehe'
   12    12    > > RETURN                                                   null

End of function z

Function y:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j5RuQ
function name:  y
number of ops:  11
compiled vars:  !0 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%5C%5B%5C%5B%5Cs%3F%28%5B%5E%5C%5D%5D%2B%29%5Cs%3F%5C%5D%2F'
          3        FETCH_THIS                                       ~1      
          4        INIT_ARRAY                                       ~2      ~1
          5        ADD_ARRAY_ELEMENT                                ~2      'z'
          6        SEND_VAL                                                 ~2
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
   16    10      > RETURN                                                   null

End of function y

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
304.53 ms | 1400 KiB | 18 Q