PHP not giving round value that I'm expecting
<p>I have php code in which I want to check value level.</p>

<p><strong>I am explaining Value level</strong></p>

<pre><code>999 or below is level 0
1999 or below &amp; higher then 1000 = level 1
2999 or below &amp; higher then 2000 = level 2
3999 or below &amp; higher then 3000 = level 3   so on....
</code></pre>

<p>I cant figure it out how can I check and do this. I know its all messed because I am using round but I cant figure any other way : <code>$level = round($v / 1000);</code></p>

<pre><code>&lt;?php
$i = 0;
$level = 0;
$v = isset($_GET['v']) ? (int)$_GET['v'] : 100;
do {
    $i++;
    $bid  = round($v / 10);
        if ($v &gt; 1000)
        {$bid = 100;}
    $level = round($v / 1000);
    echo "&lt;tr&gt;&lt;td&gt;$" . number_format($v) . "&lt;/td&gt;&lt;td&gt;$" . number_format($bid) . "&lt;/td&gt;&lt;td&gt;" . $level . "&lt;/td&gt;&lt;/tr&gt;";
    $v = $v + $bid;
} while ($i &lt; 5);
?&gt;
</code></pre>

<p><strong>Output is:</strong></p>

<pre><code>$348    $35 0
$383    $38 0
$421    $42 0
$463    $46 0
$509    $51 1
$560    $56 1
$616    $62 1
$678    $68 1
$746    $75 1
$821    $82 1
</code></pre>

<p><strong>Output I want is:</strong></p>

<pre><code>$746    $75 0
$821    $82 0
$903    $90 0
$993    $99 0
$1,092  $100    1
$1,192  $100    1
$1,292  $100    1
$1,392  $100    1
</code></pre>
