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

[php]
is_array ( mixed $value );
[/php]

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
[php]
“;
$ex = “String”;
echo is_array($ex) ? ‘$ex is an Array’ : ‘$ex is an not Array’;
?>
[/php]

Result
[php]
$shop_id is an Array
$ex is an not Array
[/php]

See also :  1 of the Best select query with where clause in codeigniter - CodeIgniter

Leave a Comment