This sounds quite simple, but i can't make it work. I'm trying to group keys with same value. I can get the key number but i cant get the name of the Key. i.e "London, Berlin". This is my code:
$countries = array (
'London' => 'Europe/London',
'Istanbul' => 'Europe/Istanbul',
'Rome' => 'Europe/Rome',
'Berlin' => 'Europe/Berlin',
'Athens' => 'Europe/Athens',
);
$offsets = Array();
foreach ($countries as $country_offset) {
$offset = timezone_offset_get( new DateTimeZone( $country_offset ), new DateTime() );
array_push($offsets, $offset);
}
$result = array_unique($offsets);
asort($result);
$keys = array_keys($result);
foreach($keys as $key) {
$numb = array_keys($offsets, $offsets[$key]);
echo $offsets[$key] . ' - ' . implode(', ', $numb ) . '<br>';
}