Access Multidimensional Array element with out knowing parent elements

后端 未结 4 964
忘了有多久
忘了有多久 2021-01-16 22:25

I have function that returns the following multidimensional array. I don\'t have control of how the array is formed. Im trying to access the \'Result\' elements. This issue

4条回答
  •  渐次进展
    2021-01-16 22:55

    If the parent elements have only one child, you can solve it by getting the only element given back by array_keys(), and going two levels deep.

    Anyway, if your array changes that much, and you systematically have to access a nested property, you have a design issue for sure.

提交回复
热议问题