note 109424 added to datetimezone.listidentifiers
| From: | jeffbanks at yahoo dot com | Date: | Mon, 16 Jul 2012 11:10:06 +0000 |
| Subject: | note 109424 added to datetimezone.listidentifiers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189155@lists.php.net to get a copy of this message | ||
Here is an update to the above which has Antarctica spelled correctly and also deals with multiple
cities such as argentina etc:
<?php
$timezone_identifiers = DateTimeZone::listIdentifiers();
foreach( $timezone_identifiers as $value ){
if ( preg_match(
'/^(America|Antarctica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $value ) ){
$ex=explode("/",$value);//obtain continent,city
if ($continent!=$ex[0]){
if ($continent!="") echo '</optgroup>';
echo '<optgroup label="'.$ex[0].'">';
}
if(isset($ex[2])) $city=$ex[1]."/".$ex[2];
else $city=$ex[1];
$continent=$ex[0];
echo '<option
value="'.$value.'">'.$city.'</option>';
}
}
?>
</optgroup>
</select>
----
Server IP: 69.147.83.197
Probable Submitter: 86.201.56.162
----
Manual Page -- http://www.php.net/manual/en/datetimezone.listidentifiers.php
Edit -- https://master.php.net/note/edit/109424
Del: integrated -- https://master.php.net/note/delete/109424/integrated
Del: useless -- https://master.php.net/note/delete/109424/useless
Del: bad code -- https://master.php.net/note/delete/109424/bad+code
Del: spam -- https://master.php.net/note/delete/109424/spam
Del: non-english -- https://master.php.net/note/delete/109424/non-english
Del: in docs -- https://master.php.net/note/delete/109424/in+docs
Del: other reasons-- https://master.php.net/note/delete/109424
Reject -- https://master.php.net/note/reject/109424
Search -- https://master.php.net/manage/user-notes.php