3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SimpleTrait { protected function foo() {} } class TraitFixtureWithFinal { use SimpleTrait { foo as final; } } $rm = new ReflectionMethod(TraitFixtureWithFinal::class, 'foo'); var_dump($rm->isFinal()); var_dump($rm->isPrivate()); var_dump($rm->isPublic()); var_dump($rm->isProtected());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0PZvm
function name:  (null)
number of ops:  27
compiled vars:  !0 = $rm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                            'traitfixturewithfinal'
   16     1        NEW                                              $1      'ReflectionMethod'
          2        SEND_VAL_EX                                              'TraitFixtureWithFinal'
          3        SEND_VAL_EX                                              'foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   17     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'isFinal'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   18    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'isPrivate'
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   19    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'isPublic'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                                 
   20    21        INIT_FCALL                                               'var_dump'
         22        INIT_METHOD_CALL                                         !0, 'isProtected'
         23        DO_FCALL                                      0  $10     
         24        SEND_VAR                                                 $10
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

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

End of function foo

End of class SimpleTrait.

Class TraitFixtureWithFinal: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.75 ms | 1011 KiB | 14 Q