php & maths - rounding?
<p>Basically, I have a number:</p>

<pre><code>&lt;?
$rating = 72.7777777778;
?&gt;
</code></pre>

<p>I basically want to do some maths to create this number as 80.</p>

<p>If the number was <code>62.7777777778</code>, the number would be 60.</p>

<p>I want the numbers rounded like so:</p>

<pre><code>20, 40, 60, 80, 100
</code></pre>

<p>So say I have three numbers:</p>

<pre><code>36.999, 47, 91
</code></pre>

<p>I would get:</p>

<pre><code>40, 40, 100
</code></pre>

<p>How do I go about doing this? I've tried with round, ceil &amp; floor but I haven't got anywhere.</p>

<p>Would it just be easier doing something like so?</p>

<pre><code>if ($rating &lt; 30){
    $rating = 20;
}elseif (($rating &gt; 30) &amp;&amp; ($rating &lt; 50)){
    $rating = 40;
}elseif (($rating &gt; 50) &amp;&amp; ($rating &lt; 70)){
    $rating = 60;
}elseif (($rating &gt; 70) &amp;&amp; ($rating &lt; 90)){
    $rating = 80;
}else{
    $rating = 100;
}
</code></pre>

<p>etc...</p>
