1.

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

Answer»

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.

Example

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

 



Discussion

No Comment Found