3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f() { return new class { function foo() { static $i = 0; echo ++$i; } }; } f()->foo(); f()->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vuHR1
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'f'
          1        DO_FCALL                                      0  $0      
          2        INIT_METHOD_CALL                                         $0, 'foo'
          3        DO_FCALL                                      0          
   16     4        INIT_FCALL                                               'f'
          5        DO_FCALL                                      0  $2      
          6        INIT_METHOD_CALL                                         $2, 'foo'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vuHR1
function name:  f
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_ANON_CLASS                               9.88131e-324    
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $1
   13     4*     > RETURN                                                   null

End of function f

Class class@anonymous:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vuHR1
function name:  foo
number of ops:  4
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
   10     1        PRE_INC                                          ~1      !0
          2        ECHO                                                     ~1
   11     3      > RETURN                                                   null

End of function foo

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.9 ms | 1398 KiB | 15 Q