3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Foo { case TEST; } $ref = new \ReflectionClass(Foo::class); var_dump($ref->getConstant('TEST')); var_dump($ref->getReflectionConstant('TEST')->getValue()); var_dump(constant('Foo::TEST'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4gqGD
function name:  (null)
number of ops:  26
compiled vars:  !0 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
    8     1        NEW                                              $1      'ReflectionClass'
          2        SEND_VAL_EX                                              'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    9     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getConstant'
          7        SEND_VAL_EX                                              'TEST'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getReflectionConstant'
         13        SEND_VAL_EX                                              'TEST'
         14        DO_FCALL                                      0  $6      
         15        INIT_METHOD_CALL                                         $6, 'getValue'
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   11    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'constant'
         21        SEND_VAL                                                 'Foo%3A%3ATEST'
         22        DO_ICALL                                         $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.27 ms | 1427 KiB | 15 Q