douqianxian7008 2015-10-07 04:45
浏览 35
已采纳

你能在php中按名称检索嵌套数组吗?

I have an array like this:

(
[data] => Array
    (
        [account_id] => 1
        [description] => my asset
        [value] => Estimate
        [value_amount] => 85000
        [type] => Vehicle
        [owner] => Array
            (
                [app_id] => 123
                [percent] => 100
            )
    )
)

Clearly I can loop through the array and pull out the nested owner array that way, but is there something similar to array_column that will get the entire owner nested array without having to loop ?

  • 写回答

2条回答 默认 最新

  • dongtuo6562 2015-10-07 04:49
    关注

    Use the indexes, no function necessary.

    $owner = $array['data']['owner']

    or..

    $percent = $array['data']['owner']['percent']

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?