3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function foo() { return function() { var_export($this); }; } } $c = new C; $c->x = 5; $f = $c->foo(); $f();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEgZF
function name:  (null)
number of ops:  11
compiled vars:  !0 = $c, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        ASSIGN_OBJ                                               !0, 'x'
          4        OP_DATA                                                  5
   13     5        INIT_METHOD_CALL                                         !0, 'foo'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
   14     8        INIT_DYNAMIC_CALL                                        !1
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FOEgZF%3A5%240

Class C:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEgZF
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOEgZF%3A5%240'
    7     1      > RETURN                                                   ~0
    8     2*     > RETURN                                                   null

End of function foo

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.14 ms | 1395 KiB | 15 Q