CKTIS / PHP
is_float()
Erkennt float ohne numerische Umwandlung.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
is_float(mixed $value): boolErkennt float ohne numerische Umwandlung. Eine Ganzzahl und eine Dezimalzahl als String ergeben false. INF und NAN haben den Typ float; bei Messwerten prüft zusätzlich is_finite die Endlichkeit.
Signatur
is_float(mixed $value): bool
Ausgabe des Beispiels
[true,false,false,true,true]
Beispiele
<?php
echo json_encode(array_map("is_float", [2.0, 2, "2.0", INF, NAN]));
Ergebnis
[true,false,false,true,true]