Skip to content

PHP Floats

Syntax

A float in PHP is a number with a decimal point or in exponential form.

// Declaring floats
$floatValue = 10.5;
$decimal = 0.15;
$otherDecimal = .15;
// Checking if a value is a float
if (is_float($floatValue)) {
echo "$floatValue is a float.";
}