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