3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Qux { public static function bar() { return __CLASS__; } } class Foo { use Qux; } $reflectionTrait = new ReflectionMethod('Qux', 'bar'); $reflectionClass = new ReflectionMethod('Foo', 'bar'); var_dump($reflectionTrait->getDeclaringClass()->getName(), $reflectionTrait->invoke(null)); var_dump($reflectionClass->getDeclaringClass()->getName(), $reflectionClass->invoke(null));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YSZZl
function name:  (null)
number of ops:  34
compiled vars:  !0 = $reflectionTrait, !1 = $reflectionClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                            'foo'
   16     1        NEW                                              $2      'ReflectionMethod'
          2        SEND_VAL_EX                                              'Qux'
          3        SEND_VAL_EX                                              'bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   17     6        NEW                                              $5      'ReflectionMethod'
          7        SEND_VAL_EX                                              'Foo'
          8        SEND_VAL_EX                                              'bar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   19    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getDeclaringClass'
         13        DO_FCALL                                      0  $8      
         14        INIT_METHOD_CALL                                         $8, 'getName'
         15        DO_FCALL                                      0  $9      
         16        SEND_VAR                                                 $9
         17        INIT_METHOD_CALL                                         !0, 'invoke'
         18        SEND_VAL_EX                                              null
         19        DO_FCALL                                      0  $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
   20    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !1, 'getDeclaringClass'
         24        DO_FCALL                                      0  $12     
         25        INIT_METHOD_CALL                                         $12, 'getName'
         26        DO_FCALL                                      0  $13     
         27        SEND_VAR                                                 $13
         28        INIT_METHOD_CALL                                         !1, 'invoke'
         29        SEND_VAL_EX                                              null
         30        DO_FCALL                                      0  $14     
         31        SEND_VAR                                                 $14
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

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

End of function bar

End of class Qux.

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.61 ms | 1396 KiB | 15 Q