Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

is_float()

Identify a floating-point value without numeric coercion.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

is_float(mixed $value): bool

Identify a floating-point value without numeric coercion. An integer or a decimal string does not pass. Infinity and NAN both have type float, so a measurement that must be finite needs an additional is_finite check.

Signature

is_float(mixed $value): bool

Example output

[true,false,false,true,true]

Examples

<?php
echo json_encode(array_map("is_float", [2.0, 2, "2.0", INF, NAN]));

Result

[true,false,false,true,true]

Sources