- First of all get the headlines
- Then iterate thru the schools
- Output the columns with their contents
echo "\n";
echo "";
foreach (array_keys(reset($city['schoolDetails'])) as $headline) {
echo "$headline | ";
}
echo "
\n";
foreach ($city['schoolDetails'] as $school) {
echo "";
displayColumn($school);
echo "
\n";
}
echo "
\n";
function displayColumn(array $array)
{
foreach ($array as $key => $value) {
echo "";
if (is_array($value)) {
echo implode(" \n", $value);
} else {
echo $value;
}
echo " | ";
}
}