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); }; } } $bar = $f->bar(); $bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AsF8t
function name:  (null)
number of ops:  6
compiled vars:  !0 = $bar, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                         !1, 'bar'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   15     3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAsF8t%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AsF8t
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%2FAsF8t%3A6%240

Function %00%7Bclosure%7D%2Fin%2FAsF8t%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AsF8t
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%2FAsF8t%3A9%241

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AsF8t
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%2FAsF8t%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/AsF8t
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%2FAsF8t%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:
160.69 ms | 1400 KiB | 15 Q