3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { function count() { static $var = 0; return ++$var; } } class B extends A {} $a = new A; var_dump($a->count()); $b = new B; var_dump($b->count()); $a2 = new A; var_dump($a2->count());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4rICv
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a, !1 = $b, !2 = $a2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $3      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   13     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'count'
          5        DO_FCALL                                          0  $6      
          6        SEND_VAR                                                     $6
          7        DO_ICALL                                                     
   14     8        NEW                                                  $8      'B'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !1, $8
   15    11        INIT_FCALL                                                   'var_dump'
         12        INIT_METHOD_CALL                                             !1, 'count'
         13        DO_FCALL                                          0  $11     
         14        SEND_VAR                                                     $11
         15        DO_ICALL                                                     
   16    16        NEW                                                  $13     'A'
         17        DO_FCALL                                          0          
         18        ASSIGN                                                       !2, $13
   17    19        INIT_FCALL                                                   'var_dump'
         20        INIT_METHOD_CALL                                             !2, 'count'
         21        DO_FCALL                                          0  $16     
         22        SEND_VAR                                                     $16
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Class A:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4rICv
function name:  count
number of ops:  4
compiled vars:  !0 = $var
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 count

End of class A.

Class B:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4rICv
function name:  count
number of ops:  4
compiled vars:  !0 = $var
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 count

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.79 ms | 2086 KiB | 14 Q