I have this json data
{
"next_offset": -1,
"records": [
{
"id": "87dad127-a60e-15a3-148e-56c7675f11df",
"name": "1A Unit",
"suite": "1A",
"sf": 1200,
"unit_floor": 1,
},
{
"id": "f386a7ad-d6ea-6eb1-9b8f-56cd6104c445",
"name": "3B Unit",
"suite": "3B",
"sf": 450,
"unit_floor": 3,
},
{
"id": "b352dc84-8c76-6c27-daa4-56cd61e71aa2",
"name": "3A Unit",
"suite": "3A",
"sf": 450,
"unit_floor": 3,
},
{
"id": "8ec4325a-1271-560e-888b-56cd6120f5de",
"name": "2B Unit",
"suite": "2B",
"sf": 450,
"unit_floor": 2,
},
{
"id": "5a15fd5e-246a-be4b-fd5d-56cd619e9ee1",
"name": "1B Unit",
"suite": "1B",
"sf": 450,
"unit_floor": 1,
},
{
"id": "61a55092-5683-1088-2d6c-56c99c5d4873",
"name": "2A Unit",
"suite": "2A",
"sf": 3000,
"unit_floor": 2,
}
]
}
I want to display this data in table depending on the floor number,. Like 3rd floor units 3A, 3B and total of their area in sqft in one row, 2nd floor units 2A, 2B and their sum of area in one row and 1st floor units 1A, 1B and their area sum in one row. Please help me.
I tried this but its not giving the expected result
$unit_response = call($url, $oauth2_token_response->access_token, 'GET');
$unit_json = json_decode(json_encode($unit_response),true);
<table class="stak-plan">
<?php foreach ($unit_json['records'] as $unit_data) { ?>
<tr>
<td>Floor: 3</td>
<td>
Suit : <?php echo $unit_data['name'] ?><br>
SF : <?php echo $unit_data['sf'] ?>
</td>
<td>Suite: 3B<br /> SF: 25,000</td>
<td>Suite: 3C<br /> SF: 25,000</td>
<td>
</td>
</tr>
<?php } ?>
</table>