3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static $data = ['a']; static function getData() { return self::$data; } } class B extends A { static $data = ['b']; static function getData() { return array_merge(parent::getData(), self::$data); } } class C extends B { static $data = ['c']; static function getData() { return array_merge(parent::getData(), self::$data); } } class D extends B { static $data = ['d']; static function getData() { return array_merge(parent::getData(), self::$data); } } $a = new A; $b = new B; $c = new C; $d = new D; var_dump($a::getData()); // Array('a'); var_dump($b::getData()); // Array('a', 'b'); var_dump($c::getData()); // Array('a', 'b', 'c'); var_dump($d::getData()); // Array('a', 'b', 'd');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZX4me
function name:  (null)
number of ops:  37
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $4      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   28     3        NEW                                              $7      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
   29     6        NEW                                              $10     'C'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $10
   30     9        NEW                                              $13     'D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !3, $13
   32    12        INIT_FCALL                                               'var_dump'
         13        FETCH_CLASS                                   0  $16     !0
         14        INIT_STATIC_METHOD_CALL                                  $16, 'getData'
         15        DO_FCALL                                      0  $17     
         16        SEND_VAR                                                 $17
         17        DO_ICALL                                                 
   33    18        INIT_FCALL                                               'var_dump'
         19        FETCH_CLASS                                   0  $19     !1
         20        INIT_STATIC_METHOD_CALL                                  $19, 'getData'
         21        DO_FCALL                                      0  $20     
         22        SEND_VAR                                                 $20
         23        DO_ICALL                                                 
   34    24        INIT_FCALL                                               'var_dump'
         25        FETCH_CLASS                                   0  $22     !2
         26        INIT_STATIC_METHOD_CALL                                  $22, 'getData'
         27        DO_FCALL                                      0  $23     
         28        SEND_VAR                                                 $23
         29        DO_ICALL                                                 
   35    30        INIT_FCALL                                               'var_dump'
         31        FETCH_CLASS                                   0  $25     !3
         32        INIT_STATIC_METHOD_CALL                                  $25, 'getData'
         33        DO_FCALL                                      0  $26     
         34        SEND_VAR                                                 $26
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

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

End of function getdata

End of class A.

Class B:
Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZX4me
function name:  getData
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'array_merge'
          1        INIT_STATIC_METHOD_CALL                                  'getData'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        FETCH_STATIC_PROP_R          unknown             ~1      'data'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
          8*     > RETURN                                                   null

End of function getdata

End of class B.

Class C:
Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZX4me
function name:  getData
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'array_merge'
          1        INIT_STATIC_METHOD_CALL                                  'getData'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        FETCH_STATIC_PROP_R          unknown             ~1      'data'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
          8*     > RETURN                                                   null

End of function getdata

End of class C.

Class D:
Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZX4me
function name:  getData
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'array_merge'
          1        INIT_STATIC_METHOD_CALL                                  'getData'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        FETCH_STATIC_PROP_R          unknown             ~1      'data'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
          8*     > RETURN                                                   null

End of function getdata

End of class D.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.15 ms | 1016 KiB | 15 Q