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) { $grade_level = (int)$grade_level; if( $grade_level == null ) { return $ability; } $grade_level = max(min($grade_level, 9), 2); echo " > $grade_level\n"; $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/6RSVi
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>
   38     1      > FE_RESET_R                                       $3      !0, ->13
          2    > > FE_FETCH_R                                               $3, !1, ->13
   39     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                                                 
   38    12      > JMP                                                      ->2
         13    >   FE_FREE                                                  $3
   40    14      > RETURN                                                   1

Function normalizelexilescore:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6RSVi
function name:  normalizeLexileScore
number of ops:  29
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        CAST                                          4  ~4      !1
          3        ASSIGN                                                   !1, ~4
   24     4        IS_EQUAL                                                 !1, null
          5      > JMPZ                                                     ~6, ->7
   25     6    > > RETURN                                                   !0
   28     7    >   INIT_FCALL                                               'max'
          8        INIT_FCALL                                               'min'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 9
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !1, $8
   29    16        ROPE_INIT                                     3  ~11     '+%3E+'
         17        ROPE_ADD                                      1  ~11     ~11, !1
         18        ROPE_END                                      2  ~10     ~11, '%0A'
         19        ECHO                                                     ~10
   30    20        ASSIGN                                                   !2, <array>
   32    21        INIT_FCALL                                               'min'
         22        SEND_VAR                                                 !0
         23        FETCH_DIM_R                                      ~14     !2, !1
         24        SEND_VAL                                                 ~14
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !3, $15
   34    27      > RETURN                                                   !3
   35    28*     > RETURN                                                   null

End of function normalizelexilescore

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.24 ms | 1402 KiB | 20 Q