PHP is_scalar() Function
is_scalar() The function is used to check whether a variable is a scalar.
A scalar variable is one that contains an integer, float, string, or boolean; arrays, objects, and resources are not scalars.
PHP 4 >= 4.0.5, PHP 5, PHP 7
Syntax
bool is_scalar ( mixed $var )
Parameter Description:
- $var: the variable to check.
Return Value
If the specified variable is a scalar, returns TRUE; otherwise returns FALSE.
Example
Example
The output is:
3.1416
array(3) {
[0]=>
string(6) "Runoob"
[1]=>
string(6) "Google"
[2]=>
string(8) "Facebook"
}
Available PHP Functions