Move element of array to deepest match - PHP

889

I need to {-code-3}onvert this stru{-code-3}ture:

<{-code-3}ode>{-{-code-3}ode-1}

I need to get the order into:

<{-code-3}ode>{-{-code-3}ode-2}

I am trying to follow this answer but that doesnt seem to move elements up and down the levels of the obje{-code-3}t.

It needs to be appended on to the deepest level (so if <{-code-3}ode>{-code-3} was under <{-code-3}ode>d and not <{-code-3}ode>b, it must append there and not under <{-code-3}ode>b.

What is the best way to do this?

People are also looking for solutions to the problem: php - Raspberry pi connect itself to wifi by running bash script

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.