3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum AgeRangeType { case UNSPECIFIED; // Not specified. case UNKNOWN; // Used for return value only. Represents value unknown in this version. case AGE_RANGE_18_24; // Between 18 and 24 years old. case AGE_RANGE_25_34; // Between 25 and 34 years old. case AGE_RANGE_35_44; // Between 35 and 44 years old. case AGE_RANGE_45_54; // Between 45 and 54 years old. case AGE_RANGE_55_64; // Between 55 and 64 years old. case AGE_RANGE_65_UP; // 65 years old and beyond. case AGE_RANGE_UNDETERMINED; // Undetermined age range. } define('AGE_RANGES', [ AgeRangeType::AGE_RANGE_18_24->name => ['min' => 18, 'max' => 24], AgeRangeType::AGE_RANGE_25_34->name => ['min' => 25, 'max' => 34], AgeRangeType::AGE_RANGE_35_44->name => ['min' => 35, 'max' => 44], AgeRangeType::AGE_RANGE_45_54->name => ['min' => 45, 'max' => 54], AgeRangeType::AGE_RANGE_55_64->name => ['min' => 55, 'max' => 64], AgeRangeType::AGE_RANGE_65_UP->name => ['min' => 65, 'max' => 135] ]); function qualifyingRanges(int $min_age, int $max_age): array { $result = []; foreach (AGE_RANGES as $rangeName => ['min' => $min, 'max' => $max]) { if ($max >= $min_age && $min <= $max_age) { $result[] = $rangeName; } elseif ($result) { break; } } return $result; } var_export(qualifyingRanges(20, 60));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1lZZk
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'agerangetype'
   16     1        INIT_FCALL                                                   'define'
          2        SEND_VAL                                                     'AGE_RANGES'
   17     3        FETCH_CLASS_CONSTANT                                 ~0      'AgeRangeType', 'AGE_RANGE_18_24'
          4        FETCH_OBJ_R                                          ~1      ~0, 'name'
          5        INIT_ARRAY                                           ~2      <array>, ~1
   18     6        FETCH_CLASS_CONSTANT                                 ~3      'AgeRangeType', 'AGE_RANGE_25_34'
          7        FETCH_OBJ_R                                          ~4      ~3, 'name'
   17     8        ADD_ARRAY_ELEMENT                                    ~2      <array>, ~4
   19     9        FETCH_CLASS_CONSTANT                                 ~5      'AgeRangeType', 'AGE_RANGE_35_44'
         10        FETCH_OBJ_R                                          ~6      ~5, 'name'
   17    11        ADD_ARRAY_ELEMENT                                    ~2      <array>, ~6
   20    12        FETCH_CLASS_CONSTANT                                 ~7      'AgeRangeType', 'AGE_RANGE_45_54'
         13        FETCH_OBJ_R                                          ~8      ~7, 'name'
   17    14        ADD_ARRAY_ELEMENT                                    ~2      <array>, ~8
   21    15        FETCH_CLASS_CONSTANT                                 ~9      'AgeRangeType', 'AGE_RANGE_55_64'
         16        FETCH_OBJ_R                                          ~10     ~9, 'name'
   17    17        ADD_ARRAY_ELEMENT                                    ~2      <array>, ~10
   22    18        FETCH_CLASS_CONSTANT                                 ~11     'AgeRangeType', 'AGE_RANGE_65_UP'
         19        FETCH_OBJ_R                                          ~12     ~11, 'name'
   17    20        ADD_ARRAY_ELEMENT                                    ~2      <array>, ~12
         21        SEND_VAL                                                     ~2
   16    22        DO_ICALL                                                     
   37    23        INIT_FCALL                                                   'var_export'
         24        INIT_FCALL                                                   'qualifyingranges'
         25        SEND_VAL                                                     20
         26        SEND_VAL                                                     60
         27        DO_FCALL                                          0  $14     
         28        SEND_VAR                                                     $14
         29        DO_ICALL                                                     
         30      > RETURN                                                       1

Function qualifyingranges:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 16
Branch analysis from position: 23
Branch analysis from position: 23
filename:       /in/1lZZk
function name:  qualifyingRanges
number of ops:  28
compiled vars:  !0 = $min_age, !1 = $max_age, !2 = $result, !3 = $min, !4 = $max, !5 = $rangeName
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   26     2        ASSIGN                                                       !2, <array>
   27     3        FETCH_CONSTANT                                       ~7      'AGE_RANGES'
          4      > FE_RESET_R                                           $8      ~7, ->23
          5    > > FE_FETCH_R                                           ~14     $8, $9, ->23
          6    >   FETCH_LIST_R                                         $10     $9, 'min'
          7        ASSIGN                                                       !3, $10
          8        FETCH_LIST_R                                         $12     $9, 'max'
          9        ASSIGN                                                       !4, $12
         10        FREE                                                         $9
         11        ASSIGN                                                       !5, ~14
   28    12        IS_SMALLER_OR_EQUAL                                  ~16     !0, !4
         13      > JMPZ_EX                                              ~16     ~16, ->16
         14    >   IS_SMALLER_OR_EQUAL                                  ~17     !3, !1
         15        BOOL                                                 ~16     ~17
         16    > > JMPZ                                                         ~16, ->20
   29    17    >   ASSIGN_DIM                                                   !2
         18        OP_DATA                                                      !5
   28    19      > JMP                                                          ->22
   30    20    > > JMPZ                                                         !2, ->22
   31    21    > > JMP                                                          ->23
   27    22    > > JMP                                                          ->5
         23    >   FE_FREE                                                      $8
   34    24        VERIFY_RETURN_TYPE                                           !2
         25      > RETURN                                                       !2
   35    26*       VERIFY_RETURN_TYPE                                           
         27*     > RETURN                                                       null

End of function qualifyingranges

Class AgeRangeType: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.04 ms | 1576 KiB | 16 Q