3v4l.org

run code in 300+ PHP versions simultaneously
<?php $grades = array( "PK", "K", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" ); function normalizeLexileScore($ability, $grade_level = null, $cast = false) { if( $grade_level == null ) { return $ability; } if ($cast) { $grade_level = (int)$grade_level; } $grade_level = max(min($grade_level, 9), 2); $gli_cap = array(NULL, NULL, 975, 1070, 1165, 1250, 1300, 1370, 1420, 1500); $normalized = min($ability, $gli_cap[$grade_level]); return $normalized; } foreach ($grades as $grade) { $minBad = normalizeLexileScore(0, $grade, false); $maxBad = normalizeLexileScore(2000, $grade, false); $minGood = normalizeLexileScore(0, $grade, true); $maxGood = normalizeLexileScore(2000, $grade, true); printf("Grade %2s: Bad: %d < %d, Good: %d < %d\n", $grade, $minBad, $maxBad, $minGood, $maxGood); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 36
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 36
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/7Lv8D
function name:  (null)
number of ops:  38
compiled vars:  !0 = $grades, !1 = $grade, !2 = $minBad, !3 = $maxBad, !4 = $minGood, !5 = $maxGood
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   38     1      > FE_RESET_R                                       $7      !0, ->36
          2    > > FE_FETCH_R                                               $7, !1, ->36
   39     3    >   INIT_FCALL                                               'normalizelexilescore'
          4        SEND_VAL                                                 0
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 <false>
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   40     9        INIT_FCALL                                               'normalizelexilescore'
         10        SEND_VAL                                                 2000
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 <false>
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !3, $10
   42    15        INIT_FCALL                                               'normalizelexilescore'
         16        SEND_VAL                                                 0
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 <true>
         19        DO_FCALL                                      0  $12     
         20        ASSIGN                                                   !4, $12
   43    21        INIT_FCALL                                               'normalizelexilescore'
         22        SEND_VAL                                                 2000
         23        SEND_VAR                                                 !1
         24        SEND_VAL                                                 <true>
         25        DO_FCALL                                      0  $14     
         26        ASSIGN                                                   !5, $14
   44    27        INIT_FCALL                                               'printf'
         28        SEND_VAL                                                 'Grade+%252s%3A+Bad%3A+%25d+%3C+%25d%2C+Good%3A+%25d+%3C+%25d%0A'
         29        SEND_VAR                                                 !1
         30        SEND_VAR                                                 !2
         31        SEND_VAR                                                 !3
         32        SEND_VAR                                                 !4
         33        SEND_VAR                                                 !5
         34        DO_ICALL                                                 
   38    35      > JMP                                                      ->2
         36    >   FE_FREE                                                  $7
   45    37      > RETURN                                                   1

Function normalizelexilescore:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/7Lv8D
function name:  normalizeLexileScore
number of ops:  27
compiled vars:  !0 = $ability, !1 = $grade_level, !2 = $cast, !3 = $gli_cap, !4 = $normalized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      <false>
   22     3        IS_EQUAL                                                 !1, null
          4      > JMPZ                                                     ~5, ->6
   23     5    > > RETURN                                                   !0
   26     6    > > JMPZ                                                     !2, ->9
   27     7    >   CAST                                          4  ~6      !1
          8        ASSIGN                                                   !1, ~6
   29     9    >   INIT_FCALL                                               'max'
         10        INIT_FCALL                                               'min'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 9
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        SEND_VAL                                                 2
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !1, $9
   30    18        ASSIGN                                                   !3, <array>
   32    19        INIT_FCALL                                               'min'
         20        SEND_VAR                                                 !0
         21        FETCH_DIM_R                                      ~12     !3, !1
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                         $13     
         24        ASSIGN                                                   !4, $13
   34    25      > RETURN                                                   !4
   35    26*     > RETURN                                                   null

End of function normalizelexilescore

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.72 ms | 1403 KiB | 23 Q