开发者

how to check if the second array key is an array?

开发者 https://www.devze.com 2022-12-26 18:47 出处:网络
i have an array which could look like this: $config[$name][$array][\'key\'] = \'value\'; // here it\'s 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消