<div id="main"> <img src="header.png"> <table class="features-table"> <thead> <tr> <td align='right'></td> <?php //$deviceSensorList = json_decode($jsonSensors, TRUE); //Print table header columns foreach ($deviceSensorList['sensors'] as $key => $val) { $tmpList = $sensors->get_sensor_area($val['sensorID']); foreach ($tmpList as $row) { $typeName = $row['moredesc']; } $tmpList = $sensors->get_sensorupdate_time($val['sensorID']); foreach ($tmpList as $row) { $dateUpdate = unixtime2Date($row['datetime']); } $stringSensors = implode(":", $val['sensorList']); echo '<td><b>' . $typeName . '</b><br><font size="1" color="gray">' . $dateUpdate . '</td>'; } echo '</tr></thead>'; //select sensors which sensorID are necessary to display, and put them to $sensoridDisplay array. $displaySensorList = []; foreach ($SensorsList as $sensorType) { $sensoridDisplay = []; foreach ($deviceSensorList['sensors'] as $key => $val) { if (in_array($sensorType, $val['sensorList'])) { $sensoridDisplay[$val['sensorIndex']] = $val['sensorID']; }