Fonction PHP is_float()
❮ Référence de gestion des variables PHP
Exemple
Vérifiez si une variable est de type float ou non :
<?php
$a = 32;
echo "a is " . is_float($a) . "<br>";
$b = 0;
echo "b is
" . is_float($b) . "<br>";
$c = 32.5;
echo "c is " . is_float($c) .
"<br>";
$d = "32";
echo "d is " . is_float($d) . "<br>";
$e =
true;
echo "e is " . is_float($e) . "<br>";
$f = "null";
echo "f
is " . is_float($f) . "<br>";
$g = 1.e3;
echo "g is " . is_float($g)
. "<br>";
?>
Définition et utilisation
La fonction is_float() vérifie si une variable est de type float ou non.
Cette fonction retourne true (1) si la variable est de type float, sinon elle retourne false.
Syntaxe
is_float(variable);
Valeurs des paramètres
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
Détails techniques
Valeur de retour : | VRAI si la variable est un flottant, FAUX sinon |
---|---|
Type de retour : | booléen |
Version PHP : | 4.0+ |
❮ Référence de gestion des variables PHP