-2

I want to make sure that I can get 3 steps from my database. My array should then look like this with 3 foreachs in each other:

user1
   user2
     user6
     user7
user2
   user3
     user7
   user4
     user8
     user9
user3
   user5
     user10
     user11
     user12
2
  • If you came across this question, knowing nothing about the specific situation, what would your reaction be? Would you have any idea how to answer it? Commented Oct 24, 2019 at 17:20
  • @PatrickQ I want to create something like this: stackoverflow.com/questions/18135685/… but then 3 times. This is 2 times. Commented Oct 24, 2019 at 17:22

1 Answer 1

0

Please, correct me if I'm wrong, but it seems that you want something like this:

foreach ($input as $k1 => $v1) {
    foreach ($v1 as $k2 => $v2) {
        foreach ($v2 as $k3 => $v3) {
            //Do something
        }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.