3v4l.org

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

End of function gradeinlist

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.83 ms | 1402 KiB | 22 Q