Skip to content
Advertisement

Print a multidimensional array in a table, keys and values

I have the following array

JavaScript

And I want to print in a table the array with KEYS and VALUES

Im currently using this foreach loop

JavaScript

Im am getting the following table

JavaScript

But I want it to look like this

JavaScript

If anyone knows how to fix it, I would be very grateful

Advertisement

Answer

Remove inner loop and access items of $value by keys (0 and 1):

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