PHP: Foreach scoring help
<p>I have this php that scores a test based on hourly answers:</p>

<pre><code>    $score_a = 0;

    foreach(array(4,5,10) as $a){
        if ($a &gt;= 2 &amp;&amp; $a &lt;= 4) {
            $score_a += 1;
        } else if ($a &gt; 4 &amp;&amp; $a &lt;= 8) {
            $score_a += 3;
        } else if ($a &gt; 8) {
            $score_a += 0;
        }
    };
</code></pre>

<p>I need the final "else if" to score a bit differently.  Instead of adding .5 once if the value is >8, I need it to add .5 for each whole number above 8.</p>

<p>So this score needs to be 5 and not 4.5.</p>
