Foreach (multi dimensional array) | SoloLearn: Learn to code for FREE!

+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.

6/11/2020 5:13:57 AM

Me&You

3 Answers

New Answer

+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

+3

Me&You you are welcome

+1

Thank you for your help.