Dealing with floating-point calculations in PHP

Long time ago – while learning PHP – I found the following piece of code:

echo intval((0.1+0.7)*10); // int(7)

and then I forgot about it. And while I can understand that the above code returns the number 7 instead of 8, the knowledge and memory of this is critically important while performing any arithmetic calculations.

Read more