PHP is_scalar() Function

PHP is_scalar() Function


Definition and Usage

The function is_scalar() whether a variable is a scalar. Scalar variables are those containing an int, float, string or bool. Types array, object and resource are not scalar.

Syntax

bool is_scalar ( mixed $value )

Parameters

Sr.No Parameter & Description
1

value

The variable being evaluated.

Return Values

This function returns true if value is a scalar, false otherwise. This function does not consider NULL to be scalar.