3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { private function foo() { echo __METHOD__; } function YinX() { $y = new y(); $y->foo(); } } class y extends x { function YinY() { $this->foo(); } } // here, Y can call private foo(); (new x)->YinX(); // here, Y cannot call foo() (new y)->YinY(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rFjoe
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $0      'x'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'YinX'
          3        DO_FCALL                                          0          
   22     4        NEW                                                  $3      'y'
          5        DO_FCALL                                          0          
          6        INIT_METHOD_CALL                                             $3, 'YinY'
          7        DO_FCALL                                          0          
   24     8      > RETURN                                                       1

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

End of function foo

Function yinx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rFjoe
function name:  YinX
number of ops:  6
compiled vars:  !0 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $1      'y'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
    8     3        INIT_METHOD_CALL                                             !0, 'foo'
          4        DO_FCALL                                          0          
    9     5      > RETURN                                                       null

End of function yinx

End of class x.

Class y:
Function yiny:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rFjoe
function name:  YinY
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                             'foo'
          1        DO_FCALL                                          0          
   15     2      > RETURN                                                       null

End of function yiny

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rFjoe
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                         'x%3A%3Afoo'
          1      > RETURN                                                       null

End of function foo

Function yinx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rFjoe
function name:  YinX
number of ops:  6
compiled vars:  !0 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $1      'y'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
    8     3        INIT_METHOD_CALL                                             !0, 'foo'
          4        DO_FCALL                                          0          
    9     5      > RETURN                                                       null

End of function yinx

End of class y.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
135.38 ms | 1492 KiB | 13 Q