如何访问嵌套数组值 [英] How to access nested array values
本文介绍了如何访问嵌套数组值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在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;
}
这篇关于如何访问嵌套数组值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文