3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { public function index() { echo 'Parent index called'; $localController = new LocalController(); if (method_exists($localController, 'hook_' . __FUNCTION__)) { $localController->{'hook_' . __FUNCTION__}(); } } } class LocalController { public function hook_index() { echo 'Child index called'; } } $controller = new Controller(); $controller->index();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rGOjb
function name:  (null)
number of ops:  6
compiled vars:  !0 = $controller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'Controller'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   27     3        INIT_METHOD_CALL                                         !0, 'index'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Controller:
Function index:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/rGOjb
function name:  index
number of ops:  12
compiled vars:  !0 = $localController
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'Parent+index+called'
    9     1        NEW                                              $1      'LocalController'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   10     4        INIT_FCALL                                               'method_exists'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'hook_index'
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->11
   12     9    >   INIT_METHOD_CALL                                         !0, 'hook_index'
         10        DO_FCALL                                      0          
   14    11    > > RETURN                                                   null

End of function index

End of class Controller.

Class LocalController:
Function hook_index:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rGOjb
function name:  hook_index
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ECHO                                                     'Child+index+called'
   23     1      > RETURN                                                   null

End of function hook_index

End of class LocalController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.37 ms | 1401 KiB | 15 Q