PHP is float

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : is_float() function

Description

The is_float () function is used to find whether a variable is a float or not.

Version

(PHP 4 and above)

Syntax

is_float (var_name)

Parameter

Name

Description

Required /
Optional

Type

var_name

The variable being checked

Required

Mixed*

*Mixed : Mixed indicates that a parameter may accept multiple (but not necessarily all) types.

Return value

TRUE if var_name is a float, FALSE otherwise.

Value Type : Boolean.

Example :

  1. $var_name=127.55;  

  2. if (is_float($var_name))  

  3. echo 'This is a float value.
    ';  

  4. else  

  5. echo 'This is a float value.
    ';  

  6. var_dump(is_float('w3resource'));  

  7. echo '
    ';  

  8. var_dump(is_float(85));  

  9. echo '
    ';  

  10. var_dump(is_float(1e8));  

  11. echo '
    ';  

  12. var_dump(is_float(true));  

  13. echo '
    ';  

  14. var_dump(is_float(array(23.3, 56, 6)));  

  15. ?>  

Output :

This is a float value.
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)