3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { public $a = 0; function f() { $increment = function () { $this->a += 1; }; $increment(); } } $i = new C; $i->f(); echo $i->a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N4tQ6
function name:  (null)
number of ops:  8
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'f'
          4        DO_FCALL                                      0          
   15     5        FETCH_OBJ_R                                      ~5      !0, 'a'
          6        ECHO                                                     ~5
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FN4tQ6%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N4tQ6
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ_OP                                 1          $0, 'a'
          2        OP_DATA                                                  1
    8     3      > RETURN                                                   null

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

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

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.76 ms | 1394 KiB | 13 Q