3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function escape($str) { return '`' . $str . '`'; } function bar() { $str = 'hello world !'; return preg_replace_callback('~\w+~', function($m){ return $this->escape($m[0]); }, $str); } } $foo = new Foo(); echo $foo->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Dchp
function name:  (null)
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7Dchp%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Dchp
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        FETCH_THIS                                       $1      
          2        INIT_METHOD_CALL                                         $1, 'escape'
          3        CHECK_FUNC_ARG                                           
          4        FETCH_DIM_FUNC_ARG                               $2      !0, 0
          5        SEND_FUNC_ARG                                            $2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   15     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7Dchp%3A13%240

Class Foo:
Function escape:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Dchp
function name:  escape
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        CONCAT                                           ~1      '%60', !0
          2        CONCAT                                           ~2      ~1, '%60'
          3      > RETURN                                                   ~2
    8     4*     > RETURN                                                   null

End of function escape

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Dchp
function name:  bar
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 'hello+++world+++%21'
   13     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%5Cw%2B%7E'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7Dchp%3A13%240'
   15     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.64 ms | 1400 KiB | 15 Q