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 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 7
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 7
Branch analysis from position: 30
Branch analysis from position: 7
Branch analysis from position: 27
filename:       /in/jaPoo
function name:  (null)
number of ops:  34
compiled vars:  !0 = $res, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'precision'
          2        SEND_VAL                                                 20
          3        DO_ICALL                                                 
   20     4        ASSIGN                                                   !0, <array>
   21     5        ASSIGN                                                   !1, 100
          6      > JMP                                                      ->28
   22     7    >   INIT_FCALL                                               'round'
          8        DIV                                              ~5      !1, 100
          9        SEND_VAL                                                 ~5
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $6      
         12        MUL                                              ~7      $6, 100
         13        CAST                                          4  ~8      ~7
         14        IS_NOT_EQUAL                                             !1, ~8
         15      > JMPZ                                                     ~9, ->27
   23    16    >   INIT_FCALL                                               'round'
         17        DIV                                              ~11     !1, 100
         18        SEND_VAL                                                 ~11
         19        SEND_VAL                                                 2
         20        DO_ICALL                                         $12     
         21        MUL                                              ~13     $12, 100
         22        CAST                                          4  ~14     ~13
         23        INIT_ARRAY                                       ~15     ~14
         24        ADD_ARRAY_ELEMENT                                ~15     !1
         25        ASSIGN_DIM                                               !0
         26        OP_DATA                                                  ~15
   21    27    >   PRE_INC                                                  !1
         28    >   IS_SMALLER                                               !1, 10000
         29      > JMPNZ                                                    ~17, ->7
   26    30    >   INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > 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/jaPoo
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:
186.58 ms | 1404 KiB | 25 Q