3v4l.org

run code in 500+ PHP versions simultaneously
<?php class C{ private $wtf="lol"; function f(){ $inherited="inherited"; $uninherited="uninherited"; // "php lambads does not inherit variables automatically" // thus to inerhit $inherited , we need use(&$inherited) call_user_func(function()use(&$inherited){ var_dump($this->wtf); var_dump($inherited); var_dump($uninherited); }); } } (new C())->f();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9X36O
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   NEW                                                  $0      'C'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'f'
          3        DO_FCALL                                          0          
          4      > RETURN                                                       1

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9X36O
function name:  f
number of ops:  7
compiled vars:  !0 = $inherited, !1 = $uninherited
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                       !0, 'inherited'
    6     1        ASSIGN                                                       !1, 'uninherited'
    9     2        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          3        BIND_LEXICAL                                                 ~4, !0
   13     4        INIT_USER_CALL                                    0          'call_user_func', ~4
          5        DO_FCALL                                          0          
   14     6      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9X36O
function name:  {closure:C::f():9}
number of ops:  12
compiled vars:  !0 = $inherited, !1 = $uninherited
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                                  !0
   10     1        INIT_FCALL                                                   'var_dump'
          2        FETCH_OBJ_R                                          ~2      'wtf'
          3        SEND_VAL                                                     ~2
          4        DO_ICALL                                                     
   11     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
   12     8        INIT_FCALL                                                   'var_dump'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                                     
   13    11      > RETURN                                                       null

End of Dynamic Function 0

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.23 ms | 3303 KiB | 14 Q