1--TEST--
2Test getdate() function : usage variation - Passing octal timestamp values
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	//octal values
20	'octal 05' => 05,
21	'octal 010' => 010,
22	'octal -010' => -010,
23);
24
25// loop through each element of the array for timestamp
26
27foreach($inputs as $key =>$value) {
28      echo "\n--$key--\n";
29      var_dump( getdate($value) );
30};
31
32?>
33===DONE===
34--EXPECTF--
35*** Testing getdate() : usage variation ***
36
37--octal 05--
38array(11) {
39  ["seconds"]=>
40  int(5)
41  ["minutes"]=>
42  int(30)
43  ["hours"]=>
44  int(5)
45  ["mday"]=>
46  int(1)
47  ["wday"]=>
48  int(4)
49  ["mon"]=>
50  int(1)
51  ["year"]=>
52  int(1970)
53  ["yday"]=>
54  int(0)
55  ["weekday"]=>
56  string(8) "Thursday"
57  ["month"]=>
58  string(7) "January"
59  [0]=>
60  int(5)
61}
62
63--octal 010--
64array(11) {
65  ["seconds"]=>
66  int(8)
67  ["minutes"]=>
68  int(30)
69  ["hours"]=>
70  int(5)
71  ["mday"]=>
72  int(1)
73  ["wday"]=>
74  int(4)
75  ["mon"]=>
76  int(1)
77  ["year"]=>
78  int(1970)
79  ["yday"]=>
80  int(0)
81  ["weekday"]=>
82  string(8) "Thursday"
83  ["month"]=>
84  string(7) "January"
85  [0]=>
86  int(8)
87}
88
89--octal -010--
90array(11) {
91  ["seconds"]=>
92  int(52)
93  ["minutes"]=>
94  int(29)
95  ["hours"]=>
96  int(5)
97  ["mday"]=>
98  int(1)
99  ["wday"]=>
100  int(4)
101  ["mon"]=>
102  int(1)
103  ["year"]=>
104  int(1970)
105  ["yday"]=>
106  int(0)
107  ["weekday"]=>
108  string(8) "Thursday"
109  ["month"]=>
110  string(7) "January"
111  [0]=>
112  int(-8)
113}
114===DONE===
115