is_array in php – PHP is_array() Examples

is_array in php – The is_array() method checks whether a variable is an Array or not. It returns Boolean value true / false only.

PHP is_array() Syntax

is_array ( mixed $value );

mixed $value | required : value which you have to check. Since this function only checks, you can pass any type of value.

Understanding mixed Type

Mixed type means that you can pass the value of any type (String, Boolean, Array, Class, Numeric) according to your need. It is not necessary to pass a special type of value only.

Return Value: If value is an array, then true is returned and false is returned in other conditions.

PHP is_array() Example

File : php_is_array.php
$ex = “String”;
echo is_array($ex) ? ‘$ex is an Array’ : ‘$ex is an not Array’;

$shop_id is an Array
$ex is an not Array

Leave a Comment