Wednesday, 7 August 2013

PHP cast to integer returns wrong value

PHP cast to integer returns wrong value

Have a look at this my friend and tell me I'm not crazy...
echo (int) (9.45 * 100); // gives 944
echo (int) 945; // gives 945
I don't understand why the first instruction would return 944!???? Is this
a known php issue? help is appreciated as always!

No comments:

Post a Comment