3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum E { case A; case B; case D; case E; } print_r(E::cases()); enum E2 { case E; case D; case B; case A; } print_r(E2::cases()); enum E3: int { case A = 3; case B = 12; case D = 1; case E = 20; } $cases = E3::cases(); uasort($cases, fn ($a, $b) => $a->value <=> $b->value); print_r($cases);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1pFL
function name:  (null)
number of ops:  25
compiled vars:  !0 = $cases
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'e'
   11     1        INIT_FCALL                                                   'print_r'
          2        INIT_STATIC_METHOD_CALL                                      'E', 'cases'
          3        DO_FCALL                                          0  $1      
          4        SEND_VAR                                                     $1
          5        DO_ICALL                                                     
   13     6        DECLARE_CLASS                                                'e2'
   20     7        INIT_FCALL                                                   'print_r'
          8        INIT_STATIC_METHOD_CALL                                      'E2', 'cases'
          9        DO_FCALL                                          0  $3      
         10        SEND_VAR                                                     $3
         11        DO_ICALL                                                     
   22    12        DECLARE_CLASS                                                'e3'
   30    13        INIT_STATIC_METHOD_CALL                                      'E3', 'cases'
         14        DO_FCALL                                          0  $5      
         15        ASSIGN                                                       !0, $5
   31    16        INIT_FCALL                                                   'uasort'
         17        SEND_REF                                                     !0
         18        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
         19        SEND_VAL                                                     ~7
         20        DO_ICALL                                                     
   32    21        INIT_FCALL                                                   'print_r'
         22        SEND_VAR                                                     !0
         23        DO_ICALL                                                     
         24      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1pFL
function name:  {closure:/in/R1pFL:31}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        FETCH_OBJ_R                                          ~2      !0, 'value'
          3        FETCH_OBJ_R                                          ~3      !1, 'value'
          4        SPACESHIP                                            ~4      ~2, ~3
          5      > RETURN                                                       ~4
          6*     > RETURN                                                       null

End of Dynamic Function 0

Class E: [no user functions]
Class E2: [no user functions]
Class E3: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.15 ms | 3481 KiB | 15 Q