3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); class Base { protected function doSomething() { echo 'here we go' . PHP_EOL; } } class Vendor extends Base { protected function doSomething() { // do something.. // call parent (Base::doSomething()) parent::doSomething(); // do something more } } class Local extends Vendor { protected function doSomething() { // do something // intention: call grand-parent (Base::doSomething()) parent::doSomething(); // this will call Vendor::doSomething() :( Base::doSomething(); // this would work, without raising a strict error (see https://bugs.php.net/bug.php?id=42016 - not a bug!) // do something more } public function api() { $this->doSomething(); } } $local = new Local; $local->api();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oAWp0
function name:  (null)
number of ops:  9
compiled vars:  !0 = $local
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   47     3        NEW                                              $2      'Local'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   48     6        INIT_METHOD_CALL                                         !0, 'api'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Base:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oAWp0
function name:  doSomething
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'here+we+go%0A'
   10     1      > RETURN                                                   null

End of function dosomething

End of class Base.

Class Vendor:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oAWp0
function name:  doSomething
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'doSomething'
          1        DO_FCALL                                      0          
   23     2      > RETURN                                                   null

End of function dosomething

End of class Vendor.

Class Local:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oAWp0
function name:  doSomething
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_STATIC_METHOD_CALL                                  'doSomething'
          1        DO_FCALL                                      0          
   36     2        INIT_STATIC_METHOD_CALL                                  'Base', 'doSomething'
          3        DO_FCALL                                      0          
   39     4      > RETURN                                                   null

End of function dosomething

Function api:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oAWp0
function name:  api
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_METHOD_CALL                                         'doSomething'
          1        DO_FCALL                                      0          
   44     2      > RETURN                                                   null

End of function api

End of class Local.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.58 ms | 1396 KiB | 15 Q