Display nested array key values in respective columns php html

Viewed 240

I have a data coming in below format in php

'Date 1' =>
  array (
    'Object 1 ' =>
    array (
      'Field 1' => Value 1,
      'Field 2' => Value 2,
      'Field 3' => Value 3,
    ),
  ),
  'Date 2' =>
  array (
    'Object 1 in Date 2' =>
    array (
      'Field 1' => Value 1,
      'Field 2' => Value 2,
    ),
    'Object 2 in Date 2' =>
    array (
      'Field 1' => Value 1,
      'Field 2' => Value 2,
      'Field 3' => Value 3,
    ),
  ),
)

I want to display the above data in HTML Table that looks something like this:

Table

I tried using nested foreach loops, however could not get the desired result. If I just want to display only key of one of the arrays it leaves the other column blank and creates another column for proceeding values.

Any thoughts would be appreciated.

1 Answers
Related