Skip to content
Advertisement

Parse multidimensional array PHP

I have the following PHP array output:

JavaScript

I am trying to find the best way to format this into the below table structure:

JavaScript

I need the loop to be flexible enough to write a new table with header for each sub array.

What is the best way to loop through this array to output new tables and header for each sub array in the array?

Advertisement

Answer

You just need a foreach inside a foreach.

Working example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement