3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo{ function hoge(){ } } class Bar extends Foo{ } $refClass = new ReflectionClass('Bar'); $refMethod = $refClass->getMethod('hoge'); var_dump($refMethod->getDeclaringClass());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dcX17
function name:  (null)
number of ops:  14
compiled vars:  !0 = $refClass, !1 = $refMethod
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $2      'ReflectionClass'
          1        SEND_VAL_EX                                                  'Bar'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   16     4        INIT_METHOD_CALL                                             !0, 'getMethod'
          5        SEND_VAL_EX                                                  'hoge'
          6        DO_FCALL                                          0  $5      
          7        ASSIGN                                                       !1, $5
   17     8        INIT_FCALL                                                   'var_dump'
          9        INIT_METHOD_CALL                                             !1, 'getDeclaringClass'
         10        DO_FCALL                                          0  $7      
         11        SEND_VAR                                                     $7
         12        DO_ICALL                                                     
         13      > RETURN                                                       1

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

End of function hoge

End of class Foo.

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

End of function hoge

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
136.52 ms | 1987 KiB | 9 Q