Skip to content

Instantly share code, notes, and snippets.

@pranid
Created September 19, 2017 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pranid/6b187aba2c43f7ba45b6aa766d4f39ed to your computer and use it in GitHub Desktop.
Save pranid/6b187aba2c43f7ba45b6aa766d4f39ed to your computer and use it in GitHub Desktop.
Get PHP timezone list
<?php
/**
* TIMEZONE GRABBER
* @author PRANEETH NIDARSHAN
*/
$zones = timezone_identifiers_list();
$new_list = array();
foreach ($zones as $zone) {
$t_zone = explode('/', $zone);
if(isset($t_zone[1])) {
$new_list[$t_zone[0]][$t_zone[1]] = $zone;
} else {
$new_list[$t_zone[0]] = $t_zone[0];
}
}
var_dump($new_list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment