PHP is_float Function

By using this function, we can check that the input value is float or not. This function was introduced in PHP 4.0.

Syntax

snippet
bool is_float ( mixed $var )

Parameters

Parameter Description Is compulsory
var The variable being evaluated. compulsory

Return type:

The is_float() function returns TRUE if the var_name is float, otherwise false.

Example 1

snippet
<?php
	$x=123.41;
	echo is_float($x);
?>

Output:

PHP variable handling is_float Function

Example 2

snippet
<?php
	$a=123.41;
	$b=12;
	var_dump (is_float($a));
	var_dump (is_float($b));
?>

Output:

PHP variable handling is_float Function

Example 3

snippet
<?php
	$var_name=126.56;
	if (is_float($var_name))
	echo 'This is a float value.<br>';
	else
	echo 'This is not a float value.<br>';
	var_dump(is_float('javatpoint'));
	echo '<br>';
	var_dump(is_float(85));
?>

Output:

PHP variable handling is_float Function

Precision::

It is a configuration setting in php.ini used to specify a total number of digits displayed in floating point number.

Here it is:

PHP variable handling is_float Function

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials

Preparation

Trending Technologies

B.Tech / MCA

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents