3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static private $fn; static public function reg() { $x = new foo; self::$fn = function () use ($x) { $x->bar(); }; } public function baz() { (self::$fn)(); } private function bar() { echo 'bar'; } } foo::reg(); $foo = new foo; $foo->baz();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE7d6
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'reg'
          1        DO_FCALL                                      0          
   27     2        NEW                                              $2      'foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   28     5        INIT_METHOD_CALL                                         !0, 'baz'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FsE7d6%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE7d6
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   BIND_STATIC                                              !0
          1        INIT_METHOD_CALL                                         !0, 'bar'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FsE7d6%3A11%240

Class foo:
Function reg:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE7d6
function name:  reg
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsE7d6%3A11%240'
          4        BIND_LEXICAL                                             ~5, !0
          5        ASSIGN_STATIC_PROP                                       'fn'
          6        OP_DATA                                                  ~5
   12     7      > RETURN                                                   null

End of function reg

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE7d6
function name:  baz
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'fn'
          1        INIT_DYNAMIC_CALL                                        ~0
          2        DO_FCALL                                      0          
   17     3      > RETURN                                                   null

End of function baz

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

End of function bar

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.91 ms | 1399 KiB | 13 Q