Silent Type Cast

../_images/silent_type_cast.png

An integer is a float, but the opposite is not always true. For PHP, pushing an integer in a function that types float its argument, makes that integer an float. The reverse conversion from float to integer is also possible, at return time. This happens when strict_types is not activated, and when the float has no decimal part, as is the case here.

Otherwise, it is a Type error, or an warning about loss of precision.

See Also

PHP Error Messages

PHP Features