function getArrayContents($array) { $result = ""; $headers = array_keys($array); if (count($headers) != 0) { for ($i = 0; $i < count($headers); $i++) { $currResult = $array[$headers[$i]]; if (is_array($currResult)) { $result .= getArrayContents($currResult); } else { $result .= $array[$headers[$i]] . "\n"; } } } return $result; //return ""; }
if (!in_array($currHeader, $headerArray)) { $headerArray[] = $currHeader; echo "<th>" . $currHeader . "</th>"; } } } echo "</tr>"; for ($i = 0; $i < count($services); $i++) { $service = $services[$i]; echo "<tr>"; echo "<td>" . ($i + 1) . "</td>"; for ($j = 0; $j < count($headerArray); $j++) { if (isset($service[$headerArray[$j]])) { $contents = $service[$headerArray[$j]]; if (is_array($contents)) { echo "<td>" . getArrayContents($contents) . "</td>"; } else { echo "<td>" . $service[$headerArray[$j]] . "</td>"; } } else { echo "<td></td>"; } } echo "</tr>"; } ?> </table> </body> </html> <?php