1--TEST-- 2Test getdate() function : usage variation - Verifyig by supplying year-wise sample time stamps since Unix epoch time 3--FILE-- 4<?php 5echo "*** Testing getdate() : usage variation ***\n"; 6 7//Set the default time zone 8date_default_timezone_set("Asia/Calcutta"); 9 10//array of values to iterate over 11$inputs = array( 12 13 //Year wise time stamps 14 '01 Jan 1970' => 0, 15 '01 Jan 1971' => 31536000, 16 '01 Jan 1972' => 63072000, 17 '01 Jan 1973' => 94694400, 18); 19 20// loop through each element of the array for timestamp 21 22foreach($inputs as $key =>$value) { 23 echo "\n--$key--\n"; 24 var_dump( getdate($value) ); 25}; 26 27?> 28--EXPECT-- 29*** Testing getdate() : usage variation *** 30 31--01 Jan 1970-- 32array(11) { 33 ["seconds"]=> 34 int(0) 35 ["minutes"]=> 36 int(30) 37 ["hours"]=> 38 int(5) 39 ["mday"]=> 40 int(1) 41 ["wday"]=> 42 int(4) 43 ["mon"]=> 44 int(1) 45 ["year"]=> 46 int(1970) 47 ["yday"]=> 48 int(0) 49 ["weekday"]=> 50 string(8) "Thursday" 51 ["month"]=> 52 string(7) "January" 53 [0]=> 54 int(0) 55} 56 57--01 Jan 1971-- 58array(11) { 59 ["seconds"]=> 60 int(0) 61 ["minutes"]=> 62 int(30) 63 ["hours"]=> 64 int(5) 65 ["mday"]=> 66 int(1) 67 ["wday"]=> 68 int(5) 69 ["mon"]=> 70 int(1) 71 ["year"]=> 72 int(1971) 73 ["yday"]=> 74 int(0) 75 ["weekday"]=> 76 string(6) "Friday" 77 ["month"]=> 78 string(7) "January" 79 [0]=> 80 int(31536000) 81} 82 83--01 Jan 1972-- 84array(11) { 85 ["seconds"]=> 86 int(0) 87 ["minutes"]=> 88 int(30) 89 ["hours"]=> 90 int(5) 91 ["mday"]=> 92 int(1) 93 ["wday"]=> 94 int(6) 95 ["mon"]=> 96 int(1) 97 ["year"]=> 98 int(1972) 99 ["yday"]=> 100 int(0) 101 ["weekday"]=> 102 string(8) "Saturday" 103 ["month"]=> 104 string(7) "January" 105 [0]=> 106 int(63072000) 107} 108 109--01 Jan 1973-- 110array(11) { 111 ["seconds"]=> 112 int(0) 113 ["minutes"]=> 114 int(30) 115 ["hours"]=> 116 int(5) 117 ["mday"]=> 118 int(1) 119 ["wday"]=> 120 int(1) 121 ["mon"]=> 122 int(1) 123 ["year"]=> 124 int(1973) 125 ["yday"]=> 126 int(0) 127 ["weekday"]=> 128 string(6) "Monday" 129 ["month"]=> 130 string(7) "January" 131 [0]=> 132 int(94694400) 133} 134