I would like to leave here this idea:
/*----------TIME ZONE LIST---------*/function TZList($data_type = false){ $_all_timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL); $TIMEZONE_LIST = array(); foreach($_all_timezone_identifiers as $k => $v){ $_tzone_group = explode("/", $_all_timezone_identifiers[$k])[0]; $_tzone_new = new DateTimeZone($_all_timezone_identifiers[$k]); $_tzone_new_date = new DateTime("now", $_tzone_new); $tzone_arr = array('timezone' => $_all_timezone_identifiers[$k],'timediff' => $_tzone_new_date->format('P'),'timezone_offset' => $_tzone_new_date->format('Z')/60, //minutes'text' => "(GMT" .$_tzone_new_date->format('P') .") " .$_all_timezone_identifiers[$k] ); //BY CONTINENT if($data_type === true) $TIMEZONE_LIST[$_tzone_group][] = $tzone_arr; else $TIMEZONE_LIST[] = $tzone_arr; } //BY TIMEZONE: "America/New_York" if(is_string($data_type)){ $key = array_search($data_type, array_column($TIMEZONE_LIST, 'timezone')); $TIMEZONE_LIST = $key !== false ? $TIMEZONE_LIST[$key] : null; } return $TIMEZONE_LIST;}/*--------------------------------*/
Thank you.