1--TEST-- 2DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone public array DateTimeZone::getLocation ( void ) ; 3--CREDITS-- 4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br 5--FILE-- 6<?php 7$arrayDate = DateTimeZone::listAbbreviations(); 8$countryCode = array("??"); 9$countryCodeTest = array("AU", "CA", "ET", "AF", "US", "KZ", "AM"); 10 11foreach($arrayDate as $value){ 12 13 if(NULL != $value[0]['timezone_id']){ 14 $timeZone = new DateTimeZone($value[0]['timezone_id']); 15 $timeZoneArray = $timeZone->getLocation(); 16 17 if((!in_array($timeZoneArray['country_code'], $countryCode)) && (NULL != $timeZoneArray['country_code']) && ("" != $timeZoneArray['country_code'])) { 18 array_push($countryCode, $timeZoneArray['country_code']); 19 20 if(in_array($timeZoneArray['country_code'], $countryCodeTest)){ 21 print_r($timeZoneArray); 22 } 23 } 24 } 25} 26?> 27--CLEAN-- 28<?php 29unset($arrayDate); 30unset($countryCode); 31unset($countryCodeTest); 32?> 33--EXPECTF-- 34Array 35( 36 [country_code] => %s 37 [latitude] => %f 38 [longitude] => %f 39 [comments] => %s 40) 41Array 42( 43 [country_code] => %s 44 [latitude] => %f 45 [longitude] => %f 46 [comments] => %s 47) 48Array 49( 50 [country_code] => %s 51 [latitude] => %f 52 [longitude] => %f 53 [comments] => %s 54) 55