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) { if( $grade_level == null ) { return $ability; } $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) { printf("%d, %s\n", normalizeLexileScore(1000, $grade), $grade); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/pCs8f
function name:  (null)
number of ops:  15
compiled vars:  !0 = $grades, !1 = $grade
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   35     1      > FE_RESET_R                                       $3      !0, ->13
          2    > > FE_FETCH_R                                               $3, !1, ->13
   36     3    >   INIT_FCALL                                               'printf'
          4        SEND_VAL                                                 '%25d%2C+%25s%0A'
          5        INIT_FCALL                                               'normalizelexilescore'
          6        SEND_VAL                                                 1000
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   35    12      > JMP                                                      ->2
         13    >   FE_FREE                                                  $3
   37    14      > RETURN                                                   1

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

End of function normalizelexilescore

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.74 ms | 1402 KiB | 20 Q