3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { const A_1 = 1; const A_2 = 2; public function test() { $refl = new ReflectionClass($this); var_dump($refl->getConstants()); } } class ab extends a { const B_1 = 'b1'; } $a = new a(); $a->test(); $b = new ab(); $b->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UWSJS
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
   23     5        NEW                                              $6      'ab'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   24     8        INIT_METHOD_CALL                                         !1, 'test'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class a:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UWSJS
function name:  test
number of ops:  11
compiled vars:  !0 = $refl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'ReflectionClass'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   11     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getConstants'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   12    10      > RETURN                                                   null

End of function test

End of class a.

Class ab:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UWSJS
function name:  test
number of ops:  11
compiled vars:  !0 = $refl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'ReflectionClass'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   11     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getConstants'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   12    10      > RETURN                                                   null

End of function test

End of class ab.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.73 ms | 1396 KiB | 15 Q