3v4l.org

run code in 300+ PHP versions simultaneously
<?php //ini_set('precision', 20); function mround($number, $precision=0) { $precision = ($precision == 0 ? 1 : $precision); $pow = pow(10, $precision); $ceil = ceil($number * $pow)/$pow; $floor = floor($number * $pow)/$pow; $pow = pow(10, $precision+1); $diffCeil = $pow*($ceil-$number); $diffFloor = $pow*($number-$floor)+($number < 0 ? -1 : 1); if($diffCeil >= $diffFloor) return $floor; else return $ceil; } $res = []; for($i=100; $i< 10000; $i++) { if (intval(round($i/100, 2)*100) != $i) { $res[] = [intval(round($i/100, 2)*100),$i]; } } var_dump($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 3
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 3
Branch analysis from position: 26
Branch analysis from position: 3
Branch analysis from position: 23
filename:       /in/VZJlD
function name:  (null)
number of ops:  30
compiled vars:  !0 = $res, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, 100
          2      > JMP                                                      ->24
   22     3    >   INIT_FCALL                                               'round'
          4        DIV                                              ~4      !1, 100
          5        SEND_VAL                                                 ~4
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $5      
          8        MUL                                              ~6      $5, 100
          9        CAST                                          4  ~7      ~6
         10        IS_NOT_EQUAL                                             !1, ~7
         11      > JMPZ                                                     ~8, ->23
   23    12    >   INIT_FCALL                                               'round'
         13        DIV                                              ~10     !1, 100
         14        SEND_VAL                                                 ~10
         15        SEND_VAL                                                 2
         16        DO_ICALL                                         $11     
         17        MUL                                              ~12     $11, 100
         18        CAST                                          4  ~13     ~12
         19        INIT_ARRAY                                       ~14     ~13
         20        ADD_ARRAY_ELEMENT                                ~14     !1
         21        ASSIGN_DIM                                               !0
         22        OP_DATA                                                  ~14
   21    23    >   PRE_INC                                                  !1
         24    >   IS_SMALLER                                               !1, 10000
         25      > JMPNZ                                                    ~16, ->3
   26    26    >   INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function mround:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
Branch analysis from position: 47
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
Branch analysis from position: 40
filename:       /in/VZJlD
function name:  mround
number of ops:  49
compiled vars:  !0 = $number, !1 = $precision, !2 = $pow, !3 = $ceil, !4 = $floor, !5 = $diffCeil, !6 = $diffFloor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    5     2        IS_EQUAL                                                 !1, 0
          3      > JMPZ                                                     ~7, ->6
          4    >   QM_ASSIGN                                        ~8      1
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~8      !1
          7    >   ASSIGN                                                   !1, ~8
    6     8        INIT_FCALL                                               'pow'
          9        SEND_VAL                                                 10
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !2, $10
    8    13        INIT_FCALL                                               'ceil'
         14        MUL                                              ~12     !0, !2
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                         $13     
         17        DIV                                              ~14     $13, !2
         18        ASSIGN                                                   !3, ~14
    9    19        INIT_FCALL                                               'floor'
         20        MUL                                              ~16     !0, !2
         21        SEND_VAL                                                 ~16
         22        DO_ICALL                                         $17     
         23        DIV                                              ~18     $17, !2
         24        ASSIGN                                                   !4, ~18
   11    25        INIT_FCALL                                               'pow'
         26        SEND_VAL                                                 10
         27        ADD                                              ~20     !1, 1
         28        SEND_VAL                                                 ~20
         29        DO_ICALL                                         $21     
         30        ASSIGN                                                   !2, $21
   13    31        SUB                                              ~23     !3, !0
         32        MUL                                              ~24     !2, ~23
         33        ASSIGN                                                   !5, ~24
   14    34        SUB                                              ~26     !0, !4
         35        MUL                                              ~27     !2, ~26
         36        IS_SMALLER                                               !0, 0
         37      > JMPZ                                                     ~28, ->40
         38    >   QM_ASSIGN                                        ~29     -1
         39      > JMP                                                      ->41
         40    >   QM_ASSIGN                                        ~29     1
         41    >   ADD                                              ~30     ~27, ~29
         42        ASSIGN                                                   !6, ~30
   16    43        IS_SMALLER_OR_EQUAL                                      !6, !5
         44      > JMPZ                                                     ~32, ->47
         45    > > RETURN                                                   !4
         46*       JMP                                                      ->48
   17    47    > > RETURN                                                   !3
   18    48*     > RETURN                                                   null

End of function mround

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.58 ms | 1404 KiB | 23 Q