note 109424 deleted from datetimezone.listidentifiers by danbrown

From: Date: Mon, 16 Jul 2012 15:00:17 +0000
Subject: note 109424 deleted from datetimezone.listidentifiers by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189162@lists.php.net to get a copy of this message
Note Submitter: jeffbanks at yahoo dot com ---- 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>

« previous php.notes (#189162) next »