note 99708 added to function.timezone-identifiers-list

From: Date: Tue, 31 Aug 2010 21:03:39 +0000
Subject: note 99708 added to function.timezone-identifiers-list
Groups: php.notes 
Request: Send a blank email to php-notes+get-172215@lists.php.net to get a copy of this message
Here's an even cleaner example of the multi-dimensional array function. I figured I based it off of one I saw here, so I might as well reciprocate. Oh yeah, this is meant to reside inside of a Date/Time utility class. If you want to use it as a global function just remove the "public static" keywords. /** * Builds a multi-dimensional array of time-zones. The first dimension * represents the "continent" and the second dimension contains all of the * time-zones that are defined within it. * * @return array() or FALSE */ public static function buildTimeZones() { if (($zones = timezone_identifiers_list()) === FALSE) { return FALSE; } // end if // (($zones = timezone_identifiers_list()) === FALSE) // $time_zones = array(); foreach ($zones as $zone) { if (strpos($zone, '/') !== FALSE) { list($continent, $city) = explode('/', $zone); } else { $continent = 'Other'; $city = $zone; } // end else // if (strpos($zone, '/') !== FALSE) // if (!array_key_exists($continent, $time_zones)) { $time_zones[$continent] = array(); } // end if // (!array_key_exists($continent, $time_zones)) // $time_zones[$continent][$zone] = $city; } // end foreach // ($zones as $zone) // return $time_zones; } ---- Server IP: 69.147.83.197 Probable Submitter: 99.72.195.138 ---- Manual Page -- http://www.php.net/manual/en/function.timezone-identifiers-list.php Edit -- https://master.php.net/note/edit/99708 Del: integrated -- https://master.php.net/note/delete/99708/integrated Del: useless -- https://master.php.net/note/delete/99708/useless Del: bad code -- https://master.php.net/note/delete/99708/bad+code Del: spam -- https://master.php.net/note/delete/99708/spam Del: non-english -- https://master.php.net/note/delete/99708/non-english Del: in docs -- https://master.php.net/note/delete/99708/in+docs Del: other reasons-- https://master.php.net/note/delete/99708 Reject -- https://master.php.net/note/reject/99708 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172215) next »