3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyParent { public function whoami() { echo get_class($this); } } class MyChild extends MyParent { public function whoami() { echo "Don't call me now!"; parent::whoami(); } } $m = new reflectionMethod('MyParent', 'whoami'); $m->invoke(new MyChild);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rc7Dk
function name:  (null)
number of ops:  11
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   NEW                                                  $1      'reflectionMethod'
          1        SEND_VAL_EX                                                  'MyParent'
          2        SEND_VAL_EX                                                  'whoami'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $1
   17     5        INIT_METHOD_CALL                                             !0, 'invoke'
          6        NEW                                                  $4      'MyChild'
          7        DO_FCALL                                          0          
          8        SEND_VAR_NO_REF_EX                                           $4
          9        DO_FCALL                                          0          
         10      > RETURN                                                       1

Class MyParent:
Function whoami:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rc7Dk
function name:  whoami
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                           ~0      
          1        GET_CLASS                                            ~1      ~0
          2        ECHO                                                         ~1
    6     3      > RETURN                                                       null

End of function whoami

End of class MyParent.

Class MyChild:
Function whoami:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rc7Dk
function name:  whoami
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                         'Don%27t+call+me+now%21'
   12     1        INIT_STATIC_METHOD_CALL                                      'whoami'
          2        DO_FCALL                                          0          
   13     3      > RETURN                                                       null

End of function whoami

End of class MyChild.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.4 ms | 2090 KiB | 13 Q