我有一个多维数组,我试图找出如何简单地“回显”数组的元素.阵列的深度是不知道的,所以它可以是深层次的.
在下面的数组的情况下,正确的回音顺序是:
This is a parent comment
This is a child comment
This is the 2nd child comment
This is another parent comment
这是我在说的数组:
Array
(
[0] => Array
(
[comment_id] => 1
[comment_content] => This is a parent comment
[child] => Array
(
[0] => Array
(
[comment_id] => 3
[comment_content] => This is a child comment
[child] => Array
(
[0] => Array
(
[comment_id] => 4
[comment_content] => This is the 2nd child comment
[child] => Array
(
)
)
)
)
)
)
[1] => Array
(
[comment_id] => 2
[comment_content] => This is another parent comment
[child] => Array
(
)
)
)