3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Ref; trait T { public $traitProperty; public function traitMethod() {} } interface I { const I = 'I'; } class A implements I { use T { T::traitMethod as tMethod; } const A = 'A'; public function __construct() {} } class B extends A { const B = 'B'; public $public = 'public'; protected static $publicStatic; } $r = new \ReflectionClass('Ref\B'); //$r->getProperty('publicStatic')->setAccessible(true); var_dump($r->getTraitNames());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l2sii
function name:  (null)
number of ops:  12
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'ref%5Ca'
   28     1        DECLARE_CLASS                                            'ref%5Cb', 'ref%5Ca'
   37     2        NEW                                              $1      'ReflectionClass'
          3        SEND_VAL_EX                                              'Ref%5CB'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   39     6        INIT_NS_FCALL_BY_NAME                                    'Ref%5Cvar_dump'
          7        INIT_METHOD_CALL                                         !0, 'getTraitNames'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

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

End of function traitmethod

End of class Ref\T.

Class Ref\I: [no user functions]
Class Ref\A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l2sii
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E > > RETURN                                                   null

End of function __construct

End of class Ref\A.

Class Ref\B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.05 ms | 1395 KiB | 15 Q