Check if a String represents a Valid Timezone with PHP

Sometimes you want to check if a string represents a valid timezone. Using PHP versions greater than 5.2, timezone_identifiers_list() could be a solution.

Take a look in the following function:

 * Check if a string is a valid timezone
 * timezone_identifiers_list() requires PHP >= 5.2
 * @param string $timezone
 * @return bool
function isValidTimezone($timezone) {
        return in_array($timezone, timezone_identifiers_list());


From PHP manual

Your comments are welcome!

MediSign - EHR for Small Medical Practices

EHR for Small Medical Practices

Medical records. Appointments. Electronic invoicing.