• PHP Video Tutorials

PHP - is_double() Function



Definition and Usage

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

Syntax

bool is_double (mixed   $value)

Parameters

Sr.No Parameter & Description
1

value

The variable being evaluated.

Return Values

This function returns true if value is a float, false otherwise.

Dependencies

PHP 4 and above

Example

Following example demonstrates return values with different types of variables −

<?php
   var_dump(is_double(10.01));    //outputs-bool(true)
   var_dump(is_double('def'));    //outputs-bool(false)
   var_dump(is_double(33));       //outputs-bool(false)
   var_dump(is_double(33.8));     //outputs-bool(true)
   var_dump(is_double(2e7));      //Scientific Notation    //outputs-bool(true)
   var_dump(is_double(false));    //outputs-bool(false)
?>

Output

This will produce following result −

bool(true)
bool(false)
bool(false)
bool(true)
bool(true)
bool(false)
php_variable_handling_functions.htm
Advertisements