how to check if the second array key is an array?
i have an array which could look like this:
$config[$name][$array]['key'] = 'value'; // here it's an array
or
$config[$name][$array] = 'value'; // here it's not an array
i want to check if the second array key ('array') 开发者_Python百科is an array or not.
could someone help me?
use the function is_array
http://php.net/manual/en/function.is-array.php
if(is_array($config[$name][$array])) echo "Yup I'm an array";
PHP has a built in function, is_array
. That should let you know whether or not you have an array, or a plain string.
精彩评论