- var_export: documentation ( source)
- asort: documentation ( source)
<?php
$countries = ['US', 'CA', 'MX', 'GB', 'IE'];
$regions = [];
foreach ($countries as $country) {
$tz = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country);
$countryRegions = [];
foreach ($tz as $tzid) {
$t = new DateTimeZone($tzid);
$countryRegions[$tzid] = $t->getLocation()['comments'] ?: 'Default';
}
asort($countryRegions);
$regions[$country] = $countryRegions;
}
var_export($regions);