• PHP Video Tutorials

PHP - is_float() Function


Advertisements

Definition and Usage

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

Syntax

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

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements