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