Foreach (multi dimensional array) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Foreach (multi dimensional array)

How to iterate over multi dimensional array in php foreach ???. 2d and 3d arrays will be enough for your answer.

11th Jun 2020, 5:13 AM
Me&You
Me&You - avatar
3 Answers
+ 5
This is the solution: <?php $my_array = [[1,2,3],[4,5,6]]; foreach($my_array as $data){ foreach($data as $number){ echo $number."<br/>"; } } ?> https://code.sololearn.com/wbY7l9m461V5/?ref=app
11th Jun 2020, 5:22 AM
Sadness
Sadness - avatar
+ 3
Me&You you are welcome
11th Jun 2020, 5:42 AM
Sadness
Sadness - avatar
+ 1
Thank you for your help.
11th Jun 2020, 5:27 AM
Me&You
Me&You - avatar