3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { public function index() { echo 'Parent index called'; var_dump(__FUNCTION__); $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/5fdBg
function name:  (null)
number of ops:  6
compiled vars:  !0 = $controller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'Controller'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     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 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/5fdBg
function name:  index
number of ops:  15
compiled vars:  !0 = $localController
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'Parent+index+called'
    8     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'index'
          3        DO_ICALL                                                 
   10     4        NEW                                              $2      'LocalController'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   11     7        INIT_FCALL                                               'method_exists'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'hook_index'
         10        DO_ICALL                                         $5      
         11      > JMPZ                                                     $5, ->14
   13    12    >   INIT_METHOD_CALL                                         !0, 'hook_index'
         13        DO_FCALL                                      0          
   15    14    > > 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/5fdBg
function name:  hook_index
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'Child+index+called'
   24     1      > RETURN                                                   null

End of function hook_index

End of class LocalController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
221.46 ms | 1396 KiB | 17 Q