PHP is double

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

PHP : is_double() function

Description

The is_double () function is used to test whether a variable is a float or not. The function is an alias of is_float().

Version

(PHP 4 and above)

Syntax

is_double (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_double($var_name))  

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

  4. else  

  5. echo 'This is not a double value.
    ';  

  6. echo '
    ';  

  7. var_dump(is_double(85));  

  8. echo '
    ';  

  9. var_dump(is_double(1e8));  

  10. echo '
    ';  

  11. var_dump(is_double(true));  

  12. echo '
    ';  

  13. var_dump(is_double(array(23.3, 56, 6)));  

  14. ?>  

Output :

This is a double value.


bool(false)
bool(true)
bool(false)
bool(false)