Why PHP Is Not My Favourite Programming Language

29th March 2003


When converting from float to integer, the number will be rounded towards zero.

If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31), the result is undefined, since the float hasn't got enough precision to give an exact integer result. No warning, not even a notice will be issued in this case!

- The PHP Documentation Group, PHP Manual, section II. Language Reference; 7. Types; Integers

Case closed.

Feedback to <mike@miketaylor.org.uk> is welcome!