3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $prop = 42; public function bar() { $f = function () { return array($this->prop, $this->lol()); }; return $f; } protected function lol() { return 37; } } $a = new Foo(); $f = $a->bar(); var_dump($f());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eiLRR
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   20     6        INIT_FCALL                                               'var_dump'
          7        INIT_DYNAMIC_CALL                                        !1
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeiLRR%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eiLRR
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'prop'
          2        INIT_ARRAY                                       ~2      ~1
          3        FETCH_THIS                                       $3      
          4        INIT_METHOD_CALL                                         $3, 'lol'
          5        DO_FCALL                                      0  $4      
          6        ADD_ARRAY_ELEMENT                                ~2      $4
          7      > RETURN                                                   ~2
    8     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeiLRR%3A6%240

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eiLRR
function name:  bar
number of ops:  4
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeiLRR%3A6%240'
          1        ASSIGN                                                   !0, ~1
   10     2      > RETURN                                                   !0
   11     3*     > RETURN                                                   null

End of function bar

Function lol:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eiLRR
function name:  lol
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   37
   15     1*     > RETURN                                                   null

End of function lol

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.15 ms | 1396 KiB | 15 Q