How to check a variable is array or not in php?

We can check a variable with the help of is_array() function in PHP. It's return true if variable is an array and return false otherwise.



$var = array('X','Y','Z');
if (is_array($var))
echo 'It is an array.';
echo 'It is not an array.';


Suggest An Answer

No suggestions avaliable!

Latest post from PHP Arrays

Ask Question