3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * gradeInList method * * Method to return a grade inlist array for the chosen team level for the dynamically created grade_range validation rule. * * @param string $level_id * @return array */ function gradeInList($level_id) { $grade_range = 'k-9'; $grade_range_arr = explode('-', $grade_range); if (strtolower($grade_range_arr[0]) == 'k') { $grade_range_arr[0] = 0; } if (stripos($grade_range,'N/A') !== false) { return array('N/A'); } $list = array(); foreach (range($grade_range_arr[0], $grade_range_arr[1]) as $grade) { if ($grade == 0) { $list[] = 'K'; continue; } if ($grade == 1) { $list[] = '1st'; continue; } if ($grade == 2) { $list[] = '2nd'; continue; } if ($grade == 3) { $list[] = '3rd'; continue; } $list[] = $grade . 'th'; } return $list; } print_r(gradeInList(NULL));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A9EOS
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'gradeinlist'
          2        SEND_VAL                                                 null
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function gradeinlist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 55
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 55
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 51
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
Branch analysis from position: 15
filename:       /in/A9EOS
function name:  gradeInList
number of ops:  58
compiled vars:  !0 = $level_id, !1 = $grade_range, !2 = $grade_range_arr, !3 = $list, !4 = $grade
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, 'k-9'
   13     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '-'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   15     7        INIT_FCALL                                               'strtolower'
          8        FETCH_DIM_R                                      ~8      !2, 0
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        IS_EQUAL                                                 $9, 'k'
         12      > JMPZ                                                     ~10, ->15
         13    >   ASSIGN_DIM                                               !2, 0
         14        OP_DATA                                                  0
   17    15    >   INIT_FCALL                                               'stripos'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 'N%2FA'
         18        DO_ICALL                                         $12     
         19        TYPE_CHECK                                  1018          $12
         20      > JMPZ                                                     ~13, ->22
         21    > > RETURN                                                   <array>
   19    22    >   ASSIGN                                                   !3, <array>
   20    23        INIT_FCALL                                               'range'
         24        FETCH_DIM_R                                      ~15     !2, 0
         25        SEND_VAL                                                 ~15
         26        FETCH_DIM_R                                      ~16     !2, 1
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                         $17     
         29      > FE_RESET_R                                       $18     $17, ->55
         30    > > FE_FETCH_R                                               $18, !4, ->55
   21    31    >   IS_EQUAL                                                 !4, 0
         32      > JMPZ                                                     ~19, ->36
         33    >   ASSIGN_DIM                                               !3
         34        OP_DATA                                                  'K'
         35      > JMP                                                      ->30
   22    36    >   IS_EQUAL                                                 !4, 1
         37      > JMPZ                                                     ~21, ->41
         38    >   ASSIGN_DIM                                               !3
         39        OP_DATA                                                  '1st'
         40      > JMP                                                      ->30
   23    41    >   IS_EQUAL                                                 !4, 2
         42      > JMPZ                                                     ~23, ->46
         43    >   ASSIGN_DIM                                               !3
         44        OP_DATA                                                  '2nd'
         45      > JMP                                                      ->30
   24    46    >   IS_EQUAL                                                 !4, 3
         47      > JMPZ                                                     ~25, ->51
         48    >   ASSIGN_DIM                                               !3
         49        OP_DATA                                                  '3rd'
         50      > JMP                                                      ->30
   25    51    >   CONCAT                                           ~28     !4, 'th'
         52        ASSIGN_DIM                                               !3
         53        OP_DATA                                                  ~28
   20    54      > JMP                                                      ->30
         55    >   FE_FREE                                                  $18
   28    56      > RETURN                                                   !3
   29    57*     > RETURN                                                   null

End of function gradeinlist

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.96 ms | 1403 KiB | 24 Q