PHP is_array() Function

PHP is_bool() Function
PHP intval() Function

In this article, you will learn how to check if a variable is an array or not. The is_array() function in PHP checks whether a variable is an array or not. This function returns true (1) if the variable is an array, otherwise, it returns false/nothing.

what is the syntax of the IS_ARRAY() function in php?

is_array(variable);
ParameterDescription
variableRequired. Specifies the variable to check
PHP is_array() method

examples of the IS_ARRAY() function

Example 1. In this example, we check whether a variable is an array or not.

<?php
$a = "Hello";
echo "a is " . is_array($a) . "<br>";

$b = array("red", "green", "blue");
echo "b is " . is_array($b) . "<br>";

$c = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
echo "c is " . is_array($c) . "<br>";

$d = "red, green, blue";
echo "d is " . is_array($d) . "<br>";
?>
PHP is_bool() Function
PHP intval() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top