如何访问嵌套数组值

问题描述:

我需要在laravel电子邮件视图模板中使用以下数组

I have the following array that I need to use in a laravel email view template

$inputs['test']

当我 dd($ inputs ['test']);

Array:1[
    "order" => array:2[
        0 => 523
        1 => 522
     ]
 ]

我已经在我的foreach循环中尝试过此操作,但这不起作用

I've tried this in my foreach loop but it doesn't work

foreach($inputs['test']->order as $test){
        echo $test;}

我需要什么语法从顺序嵌套数组中回显每个值?

What syntax would I need to echo each value from the order nested array?

您必须使用数组而不是对象循环:

You have to use array not object loop:

foreach($inputs['test']['order'] as $test){           
        echo $test;

}