3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $_foo = array(); public function bar($source) { $ref = &$this->_foo; $ref = array(); return preg_replace_callback( '/\\w+/', function ($m) use (&$ref) { $ref[] = $m[0]; return "(" . $m[0] . ")"; }, $source ); } public function foo() { print_r($this->_foo); } } $a = new A(); $a->bar("lorem ipsum dolor"); $a->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T4EOR
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        SEND_VAL_EX                                              'lorem+ipsum+dolor'
          5        DO_FCALL                                      0          
   25     6        INIT_METHOD_CALL                                         !0, 'foo'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FT4EOR%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T4EOR
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $m, !1 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        FETCH_DIM_R                                      ~3      !0, 0
          3        ASSIGN_DIM                                               !1
          4        OP_DATA                                                  ~3
   12     5        FETCH_DIM_R                                      ~4      !0, 0
          6        CONCAT                                           ~5      '%28', ~4
          7        CONCAT                                           ~6      ~5, '%29'
          8      > RETURN                                                   ~6
   13     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FT4EOR%3A10%240

Class A:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T4EOR
function name:  bar
number of ops:  13
compiled vars:  !0 = $source, !1 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_OBJ_W                                      $2      '_foo'
          2        ASSIGN_REF                                               !1, $2
    7     3        ASSIGN                                                   !1, <array>
    8     4        INIT_FCALL                                               'preg_replace_callback'
    9     5        SEND_VAL                                                 '%2F%5Cw%2B%2F'
   10     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FT4EOR%3A10%240'
          7        BIND_LEXICAL                                             ~5, !1
   13     8        SEND_VAL                                                 ~5
   14     9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11      > RETURN                                                   $6
   16    12*     > RETURN                                                   null

End of function bar

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T4EOR
function name:  foo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'print_r'
          1        FETCH_OBJ_R                                      ~0      '_foo'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   20     4      > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.65 ms | 1400 KiB | 17 Q