3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class X { public $names = array('bob', 'fred'); } Class Y extends X { public $names = array('alice');//array_merge(parent::names, array('alice')); function __construct() { var_dump($this->parent->$names); } } $x = new X(); var_dump($x->names); $y = new Y(); var_dump($y->names);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fa2kM
function name:  (null)
number of ops:  15
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~5      !0, 'names'
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                                 
   23     7        NEW                                              $7      'Y'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   24    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~10     !1, 'names'
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class X: [no user functions]
Class Y:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fa2kM
function name:  __construct
number of ops:  6
compiled vars:  !0 = $names
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~1      'parent'
          2        FETCH_OBJ_R                                      ~2      ~1, !0
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   17     5      > RETURN                                                   null

End of function __construct

End of class Y.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.89 ms | 1395 KiB | 15 Q