Is Float and Is Double Function in PHP

Introduction

In this article I explain the PHP functions Is_float and Is_double. I will first discuss the Is_float function.

The Is_float() function determines whether the type variable is float or not.

Syntax

is_float($var_name);

 

Parameter  
Var name  The find variable name is float

Example

<?php 

$var_name=123.23; 

if (is_float($var_name)) 

echo 'Float value.<br>'

else 

echo 'Not a Float value.<br>'

var_dump(is_Float(85)); 

var_dump(is_Float(1e8));  

var_dump(is_Float(true));  

var_dump(is_Float(array(23.3, 56, 6))); 

?> 

Output

float.jpg

Next, I will explain the Is_double() function. The is_double() function determines whether the variable is float or not. This function is an alias of float.

Syntax

is_double($var_name);

 

Parameter  
Var name  The variable being checked.

Example

<?php 

$var_name=123.23; 

if (is_double($var_name)) 

echo 'Double value.<br>'

else 

echo 'Not a double value.<br>'

var_dump(is_double(85)); 

var_dump(is_double(1e8));  

var_dump(is_double(true));  

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

?> 

Output

double.jpg


Similar Articles