1--TEST-- 2DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone 3public array DateTimeZone::getLocation ( void ) ; 4--CREDITS-- 5marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br 6--SKIPIF-- 7<?php 8if (phpversion() < "5.3.0") { 9 die('SKIP php version so lower.'); 10} 11?> 12--FILE-- 13<?php 14$arrayDate = DateTimeZone::listAbbreviations(); 15$countryCode = array("??"); 16$countryCodeTest = array("AU", "CA", "ET", "AF", "US", "KZ", "AM"); 17 18foreach($arrayDate as $value){ 19 20 if(NULL != $value[0]['timezone_id']){ 21 $timeZone = new DateTimeZone($value[0]['timezone_id']); 22 $timeZoneArray = $timeZone->getLocation(); 23 24 if((!in_array($timeZoneArray['country_code'], $countryCode)) && (NULL != $timeZoneArray['country_code']) && ("" != $timeZoneArray['country_code'])) { 25 array_push($countryCode, $timeZoneArray['country_code']); 26 27 if(in_array($timeZoneArray['country_code'], $countryCodeTest)){ 28 print_r($timeZoneArray); 29 } 30 } 31 } 32} 33?> 34--CLEAN-- 35<?php 36unset($arrayDate); 37unset($countryCode); 38unset($countryCodeTest); 39?> 40--EXPECTF-- 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) 55Array 56( 57 [country_code] => %s 58 [latitude] => %f 59 [longitude] => %f 60 [comments] => 61) 62Array 63( 64 [country_code] => %s 65 [latitude] => %f 66 [longitude] => %f 67 [comments] => %s 68) 69Array 70( 71 [country_code] => %s 72 [latitude] => %f 73 [longitude] => %f 74 [comments] => %s 75) 76Array 77( 78 [country_code] => %s 79 [latitude] => %f 80 [longitude] => %f 81 [comments] => 82) 83