3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { static protected $count = 0; protected $data = [1,2,3,5]; public function data() { return $this->data; } } class B extends A { protected $data = [5,6,7,89]; public function data() { self::$count++; echo self::$count, "\n"; if (self::$count >= 10) return; return static::data(); } } $b = new B(); var_dump($b->data());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c1lM1
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $1      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   16     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'data'
          5        DO_FCALL                                          0  $4      
          6        SEND_VAR                                                     $4
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Class A:
Function data:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c1lM1
function name:  data
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                          ~0      'data'
          1      > RETURN                                                       ~0
          2*     > RETURN                                                       null

End of function data

End of class A.

Class B:
Function data:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c1lM1
function name:  data
number of ops:  12
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   PRE_INC_STATIC_PROP                                          'count'
          1        FETCH_STATIC_PROP_R              unknown             ~1      'count'
          2        ECHO                                                         ~1
          3        ECHO                                                         '%0A'
          4        FETCH_STATIC_PROP_R              unknown             ~2      'count'
          5        IS_SMALLER_OR_EQUAL                                          10, ~2
          6      > JMPZ                                                         ~3, ->8
          7    > > RETURN                                                       null
          8    >   INIT_STATIC_METHOD_CALL                                      'data'
          9        DO_FCALL                                          0  $4      
         10      > RETURN                                                       $4
         11*     > RETURN                                                       null

End of function data

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.96 ms | 2200 KiB | 14 Q