PHP is real

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

PHP : is_real() function

Description

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

Version

(PHP 4 and above)

Syntax

is_real(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 real, FALSE otherwise.

Value Type : Boolean

Example :

  1. $var_name=127.55;  

  2. if (is_real($var_name))  

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

  4. else  

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

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

  7. echo '
    ';  

  8. var_dump(is_real(85));  

  9. echo '
    ';  

  10. var_dump(is_real(1e8));  

  11. echo '
    ';  

  12. var_dump(is_real(true));  

  13. echo '
    ';  

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

  15. ?>  

Output :

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