3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function counter() { static $i = 0; return ++$i; } } var_dump(A::counter()); var_dump(A::counter()); eval('class B extends A {}'); var_dump(A::counter()); echo "-------\n"; var_dump(B::counter()); var_dump(B::counter()); var_dump(B::counter());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8Mme
function name:  (null)
number of ops:  33
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'A', 'counter'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'var_dump'
          6        INIT_STATIC_METHOD_CALL                                  'A', 'counter'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   14    10        INCLUDE_OR_EVAL                                          'class+B+extends+A+%7B%7D', EVAL
   16    11        INIT_FCALL                                               'var_dump'
         12        INIT_STATIC_METHOD_CALL                                  'A', 'counter'
         13        DO_FCALL                                      0  $5      
         14        SEND_VAR                                                 $5
         15        DO_ICALL                                                 
   17    16        ECHO                                                     '-------%0A'
   18    17        INIT_FCALL                                               'var_dump'
         18        INIT_STATIC_METHOD_CALL                                  'B', 'counter'
         19        DO_FCALL                                      0  $7      
         20        SEND_VAR                                                 $7
         21        DO_ICALL                                                 
   19    22        INIT_FCALL                                               'var_dump'
         23        INIT_STATIC_METHOD_CALL                                  'B', 'counter'
         24        DO_FCALL                                      0  $9      
         25        SEND_VAR                                                 $9
         26        DO_ICALL                                                 
   20    27        INIT_FCALL                                               'var_dump'
         28        INIT_STATIC_METHOD_CALL                                  'B', 'counter'
         29        DO_FCALL                                      0  $11     
         30        SEND_VAR                                                 $11
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Class A:
Function counter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8Mme
function name:  counter
number of ops:  4
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    6     1        PRE_INC                                          ~1      !0
          2      > RETURN                                                   ~1
    7     3*     > RETURN                                                   null

End of function counter

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.36 ms | 998 KiB | 14 Q