Created
December 9, 2013 13:09
-
-
Save sscovil/7872043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Is Valid Timezone ID | |
* | |
* @param string $timezone_id Timezone ID to validate. | |
* | |
* @return bool True if timezone ID is valid; otherwise false. | |
*/ | |
function is_valid_timezone_id( $timezone_id ){ | |
$valid = array(); | |
$tza = timezone_abbreviations_list(); | |
foreach ( $tza as $zone ) | |
foreach ( $zone as $item ) | |
$valid[$item['timezone_id']] = true; | |
unset( $valid[''] ); | |
return !!$valid[$timezone_id]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment