How to echo single value from multidimensional array when key is numeric?

后端 未结 4 1542
抹茶落季
抹茶落季 2021-01-03 02:33

Take this array as an example

Array
(
[events] => Array
    (
        [0] => Array
            (
                [event] => Array
                          


        
相关标签:
4条回答
  • 2021-01-03 02:51

    It should be

    echo $array['events'][0]['event']['category'];

    0 讨论(0)
  • 2021-01-03 03:06

    You are using the object property selector.

    Try this:

    echo $array['events'][0]['event']['category'] ;
    
    0 讨论(0)
  • 2021-01-03 03:09

    Try echo $array['events'][0]['event']['category'];

    0 讨论(0)
  • 2021-01-03 03:16

    Like this:

    echo $arr['events'][0]['event']['category'];
    
    0 讨论(0)
提交回复
热议问题