1--TEST--
2Test getdate() function : usage variation - Passing hexadcimal 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	'hexadcimal 0x5' => 0x5,
21	'hexadcimal 0xCAFE' => 0xCAFE,
22	'octal -0xCAFE' => -0xCAFE,
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--EXPECT--
35*** Testing getdate() : usage variation ***
36
37--hexadcimal 0x5--
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--hexadcimal 0xCAFE--
64array(11) {
65  ["seconds"]=>
66  int(6)
67  ["minutes"]=>
68  int(56)
69  ["hours"]=>
70  int(19)
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(51966)
87}
88
89--octal -0xCAFE--
90array(11) {
91  ["seconds"]=>
92  int(54)
93  ["minutes"]=>
94  int(3)
95  ["hours"]=>
96  int(15)
97  ["mday"]=>
98  int(31)
99  ["wday"]=>
100  int(3)
101  ["mon"]=>
102  int(12)
103  ["year"]=>
104  int(1969)
105  ["yday"]=>
106  int(364)
107  ["weekday"]=>
108  string(9) "Wednesday"
109  ["month"]=>
110  string(8) "December"
111  [0]=>
112  int(-51966)
113}
114===DONE===
115