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