The PHP Function Is_Float
The php function is_float allows you to check if a variable is of type float. If it is, then it returns true, otherwise false. Using this function can save you time, and also help ensure that your code works correctly.
PHP has a number of different types of numbers: ints, floats, and doubles. This function, along with is_integer() and is_long(), are used to determine if a number is of a particular type. Using these functions will allow you to be more defensive in your programming and avoid errors that may be caused by mixing values of different types.
For example, certain libraries might require you to pass int values to their methods, but if you accidentally supply them with a float value it will likely result in an error. It is best to use one of the is_* functions (is_integer() or is_long()) to convert a number to an int before passing it to any library methods.
Other special types of numbers include infinity and NaN (not a number). The is_infinite() function checks if a number is finite, and the is_nan() function checks whether a value is NaN, which can be the result of some mathematical operations that are not possible in mathematics.