3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TouteSimple { public function foo(){ $that = $this; $func = function() use ($that){echo 'test '; var_dump($that);}; return $func(); } } $s = new TouteSimple(); $s->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LbHpr
function name:  (null)
number of ops:  6
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'TouteSimple'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

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

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

End of function foo

End of class TouteSimple.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.84 ms | 1400 KiB | 15 Q