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--SKIPIF--
6<?php
7if (phpversion() < "5.3.0") {
8  die('SKIP php version so lower.');
9}
10?>
11--FILE--
12<?php
13$arrayDate = DateTimeZone::listAbbreviations();
14$countryCode = array("??");
15$countryCodeTest = array("AU", "CA", "ET", "AF", "US", "KZ", "AM");
16
17foreach($arrayDate as $value){
18
19    if(NULL != $value[0]['timezone_id']){
20        $timeZone = new DateTimeZone($value[0]['timezone_id']);
21        $timeZoneArray = $timeZone->getLocation();
22
23        if((!in_array($timeZoneArray['country_code'], $countryCode)) && (NULL != $timeZoneArray['country_code']) && ("" != $timeZoneArray['country_code'])) {
24            array_push($countryCode, $timeZoneArray['country_code']);
25
26            if(in_array($timeZoneArray['country_code'], $countryCodeTest)){
27                print_r($timeZoneArray);
28            }
29        }
30    }
31}
32?>
33--CLEAN--
34<?php
35unset($arrayDate);
36unset($countryCode);
37unset($countryCodeTest);
38?>
39--EXPECTF--
40Array
41(
42    [country_code] => %s
43    [latitude] => %f
44    [longitude] => %f
45    [comments] => %s
46)
47Array
48(
49    [country_code] => %s
50    [latitude] => %f
51    [longitude] => %f
52    [comments] => %s
53)
54Array
55(
56    [country_code] => %s
57    [latitude] => %f
58    [longitude] => %f
59    [comments] => %s
60)
61