• PHP Video Tutorials

PHP - is_real() Function


Advertisements

Definition and Usage

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

This alias was DEPRECATED in PHP 7.4.0, and REMOVED as of PHP 8.0.0.

Syntax

bool is_real (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_real(4.01));    //outputs-bool(true)
   var_dump(is_real('ter'));   //outputs-bool(false)
   var_dump(is_real(44));      //outputs-bool(false)
   var_dump(is_real(44.8));    //outputs-bool(true)
   var_dump(is_real(3e7));     //Scientific Notation    //outputs-bool(true)
   var_dump(is_real(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