当键为数字时,如何从多维数组中回显单个值? [英] How to echo single value from multidimensional array when key is numeric?
本文介绍了当键为数字时,如何从多维数组中回显单个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以该数组为例
Array
(
[events] => Array
(
[0] => Array
(
[event] => Array
(
[category] => seminars,sales
[status] => Live
如何检索类别的值?我已经尝试过各种组合;
How do I retrieve the value of category? I've tried various combinations such;
echo $array->events->events[0]->event->category;
如此简单,但我只是想不通.
So simple, yet I just can't figure it out.
对不起,我很抱歉.
推荐答案
应该是
echo $array['events'][0]['event']['category'];
这篇关于当键为数字时,如何从多维数组中回显单个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文