How to change a variable's value multiple times in same function?
<p>I'm trying to change the variable <code>$score</code>'s value according to its <code>$total_votes</code> score.  The code now (when I <code>echo $score</code>) produces a value of 1, every time I run through the function.  It's making me believe that the <code>$score = $score+1</code> is not working properly, is there a structure in the code that i'm overlooking?</p>

<pre><code>public function score($datediff,$total_votes){
    $score = 0;
    if ($total_votes &lt; 10)                            { $score = $score+1;}
    if ($total_votes &gt; 10 &amp;&amp; $total_votes &lt; 100 )     { $score = $score+1;}
    if ($total_votes &gt; 100 &amp;&amp; $total_votes &lt; 1000 )   { $score = $score+1;}
    if ($total_votes &gt; 1000 &amp;&amp; $total_votes &lt; 10000 ) { $score = $score+1;}

    echo $score.' ';
}
</code></pre>
