w3resource

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:

<?php
$var_name=127.55;
if (is_double($var_name))
echo 'This is a double value.<br>';
else
echo 'This is not a double value.<br>';
echo '<br>';
var_dump(is_double(85));
echo '<br>';
var_dump(is_double(1e8));
echo '<br>';
var_dump(is_double(true));
echo '<br>';
var_dump(is_double(array(23.3, 56, 6)));
?>

Output:

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

View the example in the browser

Practice here online :

See also

PHP Function Reference

Previous: is_callable
Next: is_float



Follow us on Facebook and Twitter for latest update.