Multidimensional Arrays Nested to Unlimited Depth

后端 未结 6 1037
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 07:33

I have a multidimensional array nested to an unknown/unlimited depth. I\'d like to be able to loop through every element. I don\'t want to use, foreach(){foreach(){for

6条回答
  •  伪装坚强ぢ
    2020-12-06 08:22

    Recursion.

    Write a function that walks one array; for each element that is also an array, it calls itself; otherwise, when it finds the target string, it returns.

提交回复
热议问题