3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ancestor { protected $var = 'ancestor'; } class Child1 extends Ancestor { protected $var = 'child1'; } class Child2 extends Ancestor { public function output(Ancestor $subject) { echo $subject->var, "\n"; } } $child1 = new Child1(); $child2 = new Child2(); $child2->output($child1); // Output: Fatal error: Cannot access protected property Child1::$var
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K6cMk
function name:  (null)
number of ops:  10
compiled vars:  !0 = $child1, !1 = $child2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'Child1'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        NEW                                              $5      'Child2'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   24     6        INIT_METHOD_CALL                                         !1, 'output'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   25     9      > RETURN                                                   1

Class Ancestor: [no user functions]
Class Child1: [no user functions]
Class Child2:
Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K6cMk
function name:  output
number of ops:  5
compiled vars:  !0 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        FETCH_OBJ_R                                      ~1      !0, 'var'
          2        ECHO                                                     ~1
          3        ECHO                                                     '%0A'
   18     4      > RETURN                                                   null

End of function output

End of class Child2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.42 ms | 1393 KiB | 13 Q