Generating a drop down list of timezones with PHP

I would do it in PHP, except I would avoid doing preg_match 100 some times and do this to generate your list.

$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);

Also, I would use PHP’s names for the ‘timezones’ and forget about GMT offsets, which will change based on DST.
Code like that in phpbb is only that way b/c they are still supporting PHP4 and can’t rely on the DateTime or DateTimeZone objects being there.

Leave a Comment