您能在php中按名称检索嵌套数组吗
我有这样一个数组:您能在php中按名称检索嵌套数组吗,php,arrays,Php,Arrays,我有这样一个数组: ( [data] => Array ( [account_id] => 1 [description] => my asset [value] => Estimate [value_amount] => 85000 [type] => Vehicle [owner] => Array (
(
[data] => Array
(
[account_id] => 1
[description] => my asset
[value] => Estimate
[value_amount] => 85000
[type] => Vehicle
[owner] => Array
(
[app_id] => 123
[percent] => 100
)
)
)
很明显,我可以通过这种方式循环数组并拉出嵌套的
owner
数组,但是是否有类似于array\u column
的东西,可以不必循环而获得整个owner
嵌套数组?使用索引,无需函数
$owner=$array['data']['owner']
或者
$percent=$array['data']['owner']['percent']
在php中,它是一种调用关联数组的方法,这意味着索引不会是数字的,它可以是任意的。
所以你可以像这样检索数据
您只需执行$array['data']['owner']
即可,它将返回您所需的内容这是多维数据数组或它是单个数组?哎哟,要删除此:S