Availability in versions: PHP 4.0.5
Checks if the input is a scalar value.
Scalar variables are variables containing integer (integer), float, string or boolean. The array, object and resource types are not scalar.
Note: The value null is not scalar!
Note:
is_scalar() does not consider values of type
resourceto be scalar because it is an abstract data type (which may change over time). This implementation detail should not be relied upon as it may change.
| Parameter | Data type | Default value | Note |
|---|---|---|---|
$var |
mixed |
not | Variable to be checked |
bool
Returns true if the input is scalar. Otherwise false.
[Official is-scalar documentation](Official documentation)
Jan Barášek Více o autorovi
Autor článku pracuje jako seniorní vývojář a software architekt v Praze. Navrhuje a spravuje velké webové aplikace, které znáte a používáte. Od roku 2009 nabral bohaté zkušenosti, které tímto webem předává dál.
Rád vám pomůžu:
Články a novinky nejen ze světa PHP a programování. Nenechte si ujít jediný článek.
Články píše Jan Barášek © 2009-2025 | Kontakt | Mapa webu
Status | Aktualizováno: ... | en