3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Thing {} interface Foo { public function bar($baz) : Thing; } interface Bar extends Foo { public function bar($baz) : Thing; } final class Baz implements Bar { public function bar($baz) : Thing { return new Thing; } } var_dump((new ReflectionClass(Foo::class))->getMethod('bar')->getDeclaringClass()->getName()); var_dump((new ReflectionClass(Bar::class))->getMethod('bar')->getDeclaringClass()->getName()); var_dump((new ReflectionClass(Baz::class))->getMethod('bar')->getDeclaringClass()->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t7PiL
function name:  (null)
number of ops:  42
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                                'bar'
   13     1        DECLARE_CLASS                                                'baz'
   21     2        INIT_FCALL                                                   'var_dump'
          3        NEW                                                  $0      'ReflectionClass'
          4        SEND_VAL_EX                                                  'Foo'
          5        DO_FCALL                                          0          
          6        INIT_METHOD_CALL                                             $0, 'getMethod'
          7        SEND_VAL_EX                                                  'bar'
          8        DO_FCALL                                          0  $2      
          9        INIT_METHOD_CALL                                             $2, 'getDeclaringClass'
         10        DO_FCALL                                          0  $3      
         11        INIT_METHOD_CALL                                             $3, 'getName'
         12        DO_FCALL                                          0  $4      
         13        SEND_VAR                                                     $4
         14        DO_ICALL                                                     
   22    15        INIT_FCALL                                                   'var_dump'
         16        NEW                                                  $6      'ReflectionClass'
         17        SEND_VAL_EX                                                  'Bar'
         18        DO_FCALL                                          0          
         19        INIT_METHOD_CALL                                             $6, 'getMethod'
         20        SEND_VAL_EX                                                  'bar'
         21        DO_FCALL                                          0  $8      
         22        INIT_METHOD_CALL                                             $8, 'getDeclaringClass'
         23        DO_FCALL                                          0  $9      
         24        INIT_METHOD_CALL                                             $9, 'getName'
         25        DO_FCALL                                          0  $10     
         26        SEND_VAR                                                     $10
         27        DO_ICALL                                                     
   23    28        INIT_FCALL                                                   'var_dump'
         29        NEW                                                  $12     'ReflectionClass'
         30        SEND_VAL_EX                                                  'Baz'
         31        DO_FCALL                                          0          
         32        INIT_METHOD_CALL                                             $12, 'getMethod'
         33        SEND_VAL_EX                                                  'bar'
         34        DO_FCALL                                          0  $14     
         35        INIT_METHOD_CALL                                             $14, 'getDeclaringClass'
         36        DO_FCALL                                          0  $15     
         37        INIT_METHOD_CALL                                             $15, 'getName'
         38        DO_FCALL                                          0  $16     
         39        SEND_VAR                                                     $16
         40        DO_ICALL                                                     
         41      > RETURN                                                       1

Class Thing: [no user functions]
Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t7PiL
function name:  bar
number of ops:  3
compiled vars:  !0 = $baz
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        VERIFY_RETURN_TYPE                                           
          2      > RETURN                                                       null

End of function bar

End of class Foo.

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

End of function bar

End of class Bar.

Class Baz:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t7PiL
function name:  bar
number of ops:  7
compiled vars:  !0 = $baz
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
   17     1        NEW                                                  $1      'Thing'
          2        DO_FCALL                                          0          
          3        VERIFY_RETURN_TYPE                                           $1
          4      > RETURN                                                       $1
   18     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function bar

End of class Baz.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.81 ms | 2555 KiB | 14 Q