3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundRating($rating) { if($rating>=5 && $rating<0){ $rating=0; } $a=(int)$rating/1; $b= sprintf('%3f',$rating-$a); if(($b>=.1) && ($b<=.2)){ $b=0; $rating=$a; } elseif(($b>=.3 && $b<=.4)|| ($b>=.6 && $b<=.7)){ $b=.5; $rating=$a+$b; } elseif(($b>=.8) && ($b<=.9)){ $b=1; $rating=$a+$b; $a=$rating; } else{} return $rating; } echo roundRating(3.3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FM4r2
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'roundrating'
          1        SEND_VAL                                                 3.3
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function roundrating:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 47) Position 1 = 29, Position 2 = 34
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 39
2 jumps found. (Code = 46) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 49
Branch analysis from position: 43
Branch analysis from position: 33
Branch analysis from position: 34
Branch analysis from position: 28
Branch analysis from position: 20
Branch analysis from position: 7
Branch analysis from position: 5
filename:       /in/FM4r2
function name:  roundRating
number of ops:  51
compiled vars:  !0 = $rating, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        IS_SMALLER_OR_EQUAL                              ~3      5, !0
          2      > JMPZ_EX                                          ~3      ~3, ->5
          3    >   IS_SMALLER                                       ~4      !0, 0
          4        BOOL                                             ~3      ~4
          5    > > JMPZ                                                     ~3, ->7
    7     6    >   ASSIGN                                                   !0, 0
   10     7    >   CAST                                          4  ~6      !0
          8        DIV                                              ~7      ~6, 1
          9        ASSIGN                                                   !1, ~7
   11    10        INIT_FCALL                                               'sprintf'
         11        SEND_VAL                                                 '%253f'
         12        SUB                                              ~9      !0, !1
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !2, $10
   13    16        IS_SMALLER_OR_EQUAL                              ~12     0.1, !2
         17      > JMPZ_EX                                          ~12     ~12, ->20
         18    >   IS_SMALLER_OR_EQUAL                              ~13     !2, 0.2
         19        BOOL                                             ~12     ~13
         20    > > JMPZ                                                     ~12, ->24
   14    21    >   ASSIGN                                                   !2, 0
   15    22        ASSIGN                                                   !0, !1
   13    23      > JMP                                                      ->49
   17    24    >   IS_SMALLER_OR_EQUAL                              ~16     0.3, !2
         25      > JMPZ_EX                                          ~16     ~16, ->28
         26    >   IS_SMALLER_OR_EQUAL                              ~17     !2, 0.4
         27        BOOL                                             ~16     ~17
         28    > > JMPNZ_EX                                         ~16     ~16, ->34
         29    >   IS_SMALLER_OR_EQUAL                              ~18     0.6, !2
         30      > JMPZ_EX                                          ~18     ~18, ->33
         31    >   IS_SMALLER_OR_EQUAL                              ~19     !2, 0.7
         32        BOOL                                             ~18     ~19
         33    >   BOOL                                             ~16     ~18
         34    > > JMPZ                                                     ~16, ->39
   18    35    >   ASSIGN                                                   !2, 0.5
   19    36        ADD                                              ~21     !1, !2
         37        ASSIGN                                                   !0, ~21
   17    38      > JMP                                                      ->49
   21    39    >   IS_SMALLER_OR_EQUAL                              ~23     0.8, !2
         40      > JMPZ_EX                                          ~23     ~23, ->43
         41    >   IS_SMALLER_OR_EQUAL                              ~24     !2, 0.9
         42        BOOL                                             ~23     ~24
         43    > > JMPZ                                                     ~23, ->49
   22    44    >   ASSIGN                                                   !2, 1
   23    45        ADD                                              ~26     !1, !2
         46        ASSIGN                                                   !0, ~26
   24    47        ASSIGN                                                   !1, !0
   21    48      > JMP                                                      ->49
   29    49    > > RETURN                                                   !0
   30    50*     > RETURN                                                   null

End of function roundrating

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
242.82 ms | 1009 KiB | 15 Q