3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function func() { echo 'I am the parent'; } } class Bar extends Foo { public function func() { echo 'I am the child'; } } // Create instance of child class $bar = new Bar; // Create reflection class $reflected = new ReflectionClass(get_class($bar)); // Get parent method $method = $reflected->getParentClass()->getMethod('func'); // Invoke method on child object $method->invokeArgs($bar, []);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NP6j8
function name:  (null)
number of ops:  19
compiled vars:  !0 = $bar, !1 = $reflected, !2 = $method
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   NEW                                                  $3      'Bar'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
    9     3        NEW                                                  $6      'ReflectionClass'
          4        GET_CLASS                                            ~7      !0
          5        SEND_VAL_EX                                                  ~7
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $6
   12     8        INIT_METHOD_CALL                                             !1, 'getParentClass'
          9        DO_FCALL                                          0  $10     
         10        INIT_METHOD_CALL                                             $10, 'getMethod'
         11        SEND_VAL_EX                                                  'func'
         12        DO_FCALL                                          0  $11     
         13        ASSIGN                                                       !2, $11
   15    14        INIT_METHOD_CALL                                             !2, 'invokeArgs'
         15        SEND_VAR_EX                                                  !0
         16        SEND_VAL_EX                                                  <array>
         17        DO_FCALL                                          0          
         18      > RETURN                                                       1

Class Foo:
Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NP6j8
function name:  func
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                         'I+am+the+parent'
          1      > RETURN                                                       null

End of function func

End of class Foo.

Class Bar:
Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NP6j8
function name:  func
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                         'I+am+the+child'
          1      > RETURN                                                       null

End of function func

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.25 ms | 2173 KiB | 13 Q