php integer and float comparison mismatch
<p>I have the following code</p>

<pre><code>$amount1 = 7299;
$amount2 = 72.9875;

$amount2_in_cents = round($amount2, 2) * 100;

if ($amount1 != $amount2_in_cents) {
    echo "Amount $amount1 != $amount2_in_cents\n";

    var_dump($amount1);
    var_dump($amount2_in_cents);    

} else {
    echo "Amounts matched";
}
</code></pre>

<p>and this is the output</p>

<pre><code>Amount 7299 != 7299
int(7299)
float(7299)
</code></pre>

<p>Now I realise that floats and int are different, but given the rounding i would have expected the two values to match. And I have solved it by casting to int.</p>

<p>So my question is why does this comparison not work as i would have expected (both values matching)?</p>
