Friday, 23 August 2013

converting from float to Int in php

converting from float to Int in php

I am trying to understand converting from a float to an int in PHP ,and
came across the following code:
echo (int) ( (0.1+0.7) * 10 ); // echoes 7!
My question is why does it echo 7 instead of 8? What is the logic behind it?

No comments:

Post a Comment