Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    It seems there is a special case in your output that won't make any solution straightforward. You want key1/key11/key114 to be A,B,C,D, when the obvious recursive output would be key1/key11/key114/0 = A, key1/key11/key114/1 = B, key1/key11/key114/2 = C, key1/key11/key114/3 = D. The output you desire will only happen if you have a limited recursion depth or something. Commented Nov 16, 2013 at 19:32
  • @Havenard, I need in this way only, if please suggest me another recursive function to do me a job as i expected. Commented Nov 16, 2013 at 19:35
  • @Lorenz Meyer What was the complicated you saying in this? Commented Nov 16, 2013 at 19:37
  • It was this that made me say complicated : $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($someArray), RecursiveIteratorIterator::SELF_FIRST); Commented Nov 16, 2013 at 19:56
  • Using recursive iterators on problems with recursion shouldn't be complicated - in fact the RecursiveIteratorIterator unrolls all the recursiveness into a flat loop - that looks pretty easy to me. Commented Nov 16, 2013 at 21:43