1--TEST-- 2Test getdate() function : usage variation - Verifyig with different timezones on Unix epoch timestamp 3--FILE-- 4<?php 5echo "*** Testing getdate() : usage variation ***\n"; 6 7//Timezones with required data for date_sunrise 8$inputs = array ( 9 //GMT-11 10 "Pacific/Samoa", 11 //GMT-9 12 "US/Alaska", 13 //GMT-0 14 "Africa/Casablanca", 15 //GMT+4 16 "Europe/Moscow", 17 //GMT+8 18 "Asia/Hong_Kong", 19 //GMT+10 20 "Australia/Brisbane", 21 //GMT+12 22 "Pacific/Wallis", 23); 24 25// loop through each element of the array for timestamp 26foreach($inputs as $timezone) { 27 echo "\n--$timezone--\n"; 28 date_default_timezone_set($timezone); 29 var_dump( getdate(0) ); 30}; 31?> 32--EXPECT-- 33*** Testing getdate() : usage variation *** 34 35--Pacific/Samoa-- 36array(11) { 37 ["seconds"]=> 38 int(0) 39 ["minutes"]=> 40 int(0) 41 ["hours"]=> 42 int(13) 43 ["mday"]=> 44 int(31) 45 ["wday"]=> 46 int(3) 47 ["mon"]=> 48 int(12) 49 ["year"]=> 50 int(1969) 51 ["yday"]=> 52 int(364) 53 ["weekday"]=> 54 string(9) "Wednesday" 55 ["month"]=> 56 string(8) "December" 57 [0]=> 58 int(0) 59} 60 61--US/Alaska-- 62array(11) { 63 ["seconds"]=> 64 int(0) 65 ["minutes"]=> 66 int(0) 67 ["hours"]=> 68 int(14) 69 ["mday"]=> 70 int(31) 71 ["wday"]=> 72 int(3) 73 ["mon"]=> 74 int(12) 75 ["year"]=> 76 int(1969) 77 ["yday"]=> 78 int(364) 79 ["weekday"]=> 80 string(9) "Wednesday" 81 ["month"]=> 82 string(8) "December" 83 [0]=> 84 int(0) 85} 86 87--Africa/Casablanca-- 88array(11) { 89 ["seconds"]=> 90 int(0) 91 ["minutes"]=> 92 int(0) 93 ["hours"]=> 94 int(0) 95 ["mday"]=> 96 int(1) 97 ["wday"]=> 98 int(4) 99 ["mon"]=> 100 int(1) 101 ["year"]=> 102 int(1970) 103 ["yday"]=> 104 int(0) 105 ["weekday"]=> 106 string(8) "Thursday" 107 ["month"]=> 108 string(7) "January" 109 [0]=> 110 int(0) 111} 112 113--Europe/Moscow-- 114array(11) { 115 ["seconds"]=> 116 int(0) 117 ["minutes"]=> 118 int(0) 119 ["hours"]=> 120 int(3) 121 ["mday"]=> 122 int(1) 123 ["wday"]=> 124 int(4) 125 ["mon"]=> 126 int(1) 127 ["year"]=> 128 int(1970) 129 ["yday"]=> 130 int(0) 131 ["weekday"]=> 132 string(8) "Thursday" 133 ["month"]=> 134 string(7) "January" 135 [0]=> 136 int(0) 137} 138 139--Asia/Hong_Kong-- 140array(11) { 141 ["seconds"]=> 142 int(0) 143 ["minutes"]=> 144 int(0) 145 ["hours"]=> 146 int(8) 147 ["mday"]=> 148 int(1) 149 ["wday"]=> 150 int(4) 151 ["mon"]=> 152 int(1) 153 ["year"]=> 154 int(1970) 155 ["yday"]=> 156 int(0) 157 ["weekday"]=> 158 string(8) "Thursday" 159 ["month"]=> 160 string(7) "January" 161 [0]=> 162 int(0) 163} 164 165--Australia/Brisbane-- 166array(11) { 167 ["seconds"]=> 168 int(0) 169 ["minutes"]=> 170 int(0) 171 ["hours"]=> 172 int(10) 173 ["mday"]=> 174 int(1) 175 ["wday"]=> 176 int(4) 177 ["mon"]=> 178 int(1) 179 ["year"]=> 180 int(1970) 181 ["yday"]=> 182 int(0) 183 ["weekday"]=> 184 string(8) "Thursday" 185 ["month"]=> 186 string(7) "January" 187 [0]=> 188 int(0) 189} 190 191--Pacific/Wallis-- 192array(11) { 193 ["seconds"]=> 194 int(0) 195 ["minutes"]=> 196 int(0) 197 ["hours"]=> 198 int(12) 199 ["mday"]=> 200 int(1) 201 ["wday"]=> 202 int(4) 203 ["mon"]=> 204 int(1) 205 ["year"]=> 206 int(1970) 207 ["yday"]=> 208 int(0) 209 ["weekday"]=> 210 string(8) "Thursday" 211 ["month"]=> 212 string(7) "January" 213 [0]=> 214 int(0) 215} 216