I have an php array (with comments) that has to be ordered differently.
The order of the array content should be like this...
parent
child
child
child
parent
child
child
etc.
The parent comments have "parent = 0". The child comments have the id of their parent (e.g. "parent = 1"). The depth/amount of child comments is unknown.
How can get an array with the mentioned order when I have for example this kind of array?
Array
(
[0] => Array
(
[comment_id] => 1
[parent] => 0
)
[1] => Array
(
[comment_id] => 2
[parent] => 0
)
[2] => Array
(
[comment_id] => 3
[parent] => 1
)
[3] => Array
(
[comment_id] => 4
[parent] => 3
)
)