is_scalar
bool is_scalar(mixed value)
Test whether a value is a scalar.
Returns:
TRUE if the value is a scalar; FALSE otherwise
Description:
is_scalar() tests whether a value is a scalar value. Values of types boolean, double, integer, or string are considered to be scalar values.
If the value is a scalar, the function returns TRUE. If not, FALSE is returned.
Availability:
UNIX, Windows
Version:
PHP 4.0.5+
See also:
gettype()
Example:
Test whether a value is scalar
$value = array (1); if (is_scalar ($value)) print "Value \$value is a scalar value."; else print "Value \$value is not a scalar value."; |
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.