Why my mathematical if statement fails?
<p>I am writing simple drop formula for player A vs. B fights - level difference determinates drop rate. My issue here is that instead of <code>0: &gt; 10 ||| 1 vs. 1 = 10%</code> it gives <code>0: &gt; 10 ||| 1 vs. 1 = 0%</code> - why?</p>

<p>PhpFiddle: <a href="http://www.phpfiddle.org/main/code/n1q-dw7" rel="nofollow">http://www.phpfiddle.org/main/code/n1q-dw7</a></p>

<pre><code>&lt;?php

# lets simulate high level player A attacks low level player B
for ($A = 1; $A &lt;= 100; $A++) {
    $B = 1;
    calculateMoneyDrop($A,$B);
}

# lets simulate low level player A attacks high level player B
for ($B = 1; $B &lt;= 100; $B++) {
    $A = 1;
    calculateMoneyDrop($A,$B);
}

function calculateMoneyDrop($A,$B) {
    $X = $A - $B;
    echo '&lt;strong&gt;', $X, '&lt;/strong&gt;: ';

    switch ($X) {
        case $X &gt; 10:
            echo "&gt; 10 ||| ";
            $X = 10;
            break;
        case $X &lt; -90:
            echo "&lt; -90 ||| ";
            $X = -90;
            break;
    }

    $dropRate = 10 - $X;
    echo $A, ' vs. ', $B, ' = ', $dropRate, '%&lt;br&gt;';

}
</code></pre>
