CopyPastehas never been so tasty!

Using is_array() function in PHP.

by anonymous

  • 0
  • 0
  • 0




Arrays are just like the variable that store values but arrays can use to store more than one value. Variable only store one value. There are three types of arrays


  • Numeric arrays
  • Associative array
  • Multidimensional array



Is_array () function:


It is a function that is used to check whether the variable is array or not. This function takes variable as a parameter to check that variable is an array or not.






is_array (var_name)



Using is_array() function in PHP.:



In order to check whether the variable is array or not, we use is_array () function of php. This function returns true or false. In the given code we take an array and a string and check both of them by using is_array () function.






$yes = array('this', 'is', 'an array');

echo is_array($yes) ? 'Array' : 'not an Array';

echo "<br />";

$no = 'this is a string';

echo is_array($no) ? 'Array' : 'Not an Array';




This is simple code to use is_array () function in PHP.


This simple article tells that how can we use is_array () function in PHP.

Add A Comment: