PHP - is_float
Trieda
Metóda - is_float
(PHP 4, PHP 5, PHP 7)
The is_float() function checks whether a given value of the
float type.
The function works only for numeric values. If the given value is a string,
the function returns false.
Procedurálne
- function is_float (mixed $var) : bool
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $var | mixed | A value/variable to be checked. |
Mávratovej hodnoty
Vracia: bool
Returns true if the given value is of the float
type, false otherwise.
Príklady
<?php
var_dump(is_float(12.75)); // True
var_dump(is_float(6)); // False
var_dump(is_float(7.0)); // True
var_dump(is_float('27.25')); // False - string values are evaluated as false
var_dump(is_float(5e4)); // True - supports the scientific notation
var_dump(is_float(null)); // False
var_dump(is_float(true)); // False
Súvisiace manuály
- function is_array (mixed $var) : bool
- function is_bool (mixed $var) : bool
- function is_int (mixed $var) : bool
- function is_numeric (mixed $var) : bool
- function is_string (mixed $var) : bool
