PHP Array is_array


is_array()

PHP is_array() function is used to detect whether the variable is an array, this function is particularly useful for some security checks(such as forms or SESSION check, etc.).

grammar:

bool is_array(mixed var)

Returns TRUE if var is array, otherwise returns FALSE.

example:

$arr_age = array(18, 20, 25);
if(is_array($arr_age)) {
     echo 'variable $arr_age is an array';
} else {
     echo 'variable $arr_age is not an array';
}

Run the example output:

The variable $arr_age is an array



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook