3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { $that = $this; return static function() use($that) { var_dump($that); }; } public function baz() { return function() { var_dump($this); }; } } $f = new Foo(); $bar = $f->bar(); $bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YU3iK
function name:  (null)
number of ops:  9
compiled vars:  !0 = $f, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   14     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   16     6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FYU3iK%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YU3iK
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
          1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2FYU3iK%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YU3iK
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYU3iK%3A9%241

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

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YU3iK
function name:  baz
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYU3iK%3A9%241'
          1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.97 ms | 1392 KiB | 15 Q