Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP is_scalar() Function

PHP is_scalar() Function

PHP Available FunctionsAvailable PHP Functions

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:

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"

}

PHP Available FunctionsAvailable PHP Functions