3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function escape($str) { return '`' . $str . '`'; } function bar() { $str = 'hello world !'; $cb = array($this, 'escape'); return preg_replace_callback('~\w+~', function($m) use ($cb) { return call_user_func($cb, $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/O7EKD
function name:  (null)
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FO7EKD%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O7EKD
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $m, !1 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   15     2        INIT_USER_CALL                                1          'call_user_func', !1
          3        FETCH_DIM_R                                      ~2      !0, 0
          4        SEND_USER                                                ~2
          5        DO_FCALL                                      0  $3      
          6      > RETURN                                                   $3
   16     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FO7EKD%3A14%240

Class Foo:
Function escape:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O7EKD
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/O7EKD
function name:  bar
number of ops:  14
compiled vars:  !0 = $str, !1 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 'hello+++world+++%21'
   13     1        FETCH_THIS                                       ~3      
          2        INIT_ARRAY                                       ~4      ~3
          3        ADD_ARRAY_ELEMENT                                ~4      'escape'
          4        ASSIGN                                                   !1, ~4
   14     5        INIT_FCALL                                               'preg_replace_callback'
          6        SEND_VAL                                                 '%7E%5Cw%2B%7E'
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FO7EKD%3A14%240'
          8        BIND_LEXICAL                                             ~6, !1
   16     9        SEND_VAL                                                 ~6
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12      > RETURN                                                   $7
   17    13*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.81 ms | 1400 KiB | 15 Q