3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait SimpleTrait { final public function final_pub() {} public function pub() {} } class Test { use SimpleTrait { final_pub as private; pub as final; pub as private; } } foreach (['final_pub', 'pub'] as $method) { echo "--- Method: $method ---\n"; $rm = new ReflectionMethod(Test::class, $method); var_dump($rm->isFinal()); var_dump($rm->isPublic()); var_dump($rm->isPrivate()); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 28
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/nJn5V
function name:  (null)
number of ops:  30
compiled vars:  !0 = $method, !1 = $rm
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                                'test'
   19     1      > FE_RESET_R                                           $2      <array>, ->28
          2    > > FE_FETCH_R                                                   $2, !0, ->28
   20     3    >   ROPE_INIT                                         3  ~4      '---+Method%3A+'
          4        ROPE_ADD                                          1  ~4      ~4, !0
          5        ROPE_END                                          2  ~3      ~4, '+---%0A'
          6        ECHO                                                         ~3
   21     7        NEW                                                  $6      'ReflectionMethod'
          8        SEND_VAL_EX                                                  'Test'
          9        SEND_VAR_EX                                                  !0
         10        DO_FCALL                                          0          
         11        ASSIGN                                                       !1, $6
   22    12        INIT_FCALL                                                   'var_dump'
         13        INIT_METHOD_CALL                                             !1, 'isFinal'
         14        DO_FCALL                                          0  $9      
         15        SEND_VAR                                                     $9
         16        DO_ICALL                                                     
   23    17        INIT_FCALL                                                   'var_dump'
         18        INIT_METHOD_CALL                                             !1, 'isPublic'
         19        DO_FCALL                                          0  $11     
         20        SEND_VAR                                                     $11
         21        DO_ICALL                                                     
   24    22        INIT_FCALL                                                   'var_dump'
         23        INIT_METHOD_CALL                                             !1, 'isPrivate'
         24        DO_FCALL                                          0  $13     
         25        SEND_VAR                                                     $13
         26        DO_ICALL                                                     
   19    27      > JMP                                                          ->2
         28    >   FE_FREE                                                      $2
   25    29      > RETURN                                                       1

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

End of function final_pub

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

End of function pub

End of class SimpleTrait.

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.77 ms | 942 KiB | 9 Q