The program below gets a list of the time zone abbreviations and displays it and the related information in an nested unordered list using a recursive printing function.
<!DOCTYPE html> <html> <head> </head> <body> <?php // A recursive variable printing function for automatically nesting arrays in lists. function PrintAsList($qVar) { if (is_array($qVar)) { echo "<ul>".PHP_EOL; foreach($qVar as $sKey => $sValue) { echo " <li> [".$sKey."] => "; PrintAsList($sValue); echo "</li>".PHP_EOL; } echo "</ul>".PHP_EOL; } else { echo $qVar; } } // Get a list of the time zone abbreviations and the associated data. $qaaTimezoneAbbrList = DateTimeZone::listAbbreviations(); // Print out the list recursive in a nested unordered list. PrintAsList($qaaTimezoneAbbrList); ?> </body> </html>
© 20072024 XoaX.net LLC. All rights reserved.