1--TEST--
2Test localtime() function : usage variation - Passing hexa decimal values to timestamp.
3--FILE--
4<?php
5echo "*** Testing localtime() : usage variation ***\n";
6
7date_default_timezone_set("UTC");
8// Initialise function arguments not being substituted (if any)
9$is_associative = true;
10
11//array of values to iterate over
12$inputs = array(
13
14      'Hexa-decimal 0' => 0x0,
15      'Hexa-decimal 10' => 0xA,
16      'Hexa-decimal -10' => -0XA
17);
18
19foreach($inputs as $key =>$value) {
20      echo "\n--$key--\n";
21      var_dump( localtime($value) );
22      var_dump( localtime($value, $is_associative) );
23}
24
25?>
26--EXPECT--
27*** Testing localtime() : usage variation ***
28
29--Hexa-decimal 0--
30array(9) {
31  [0]=>
32  int(0)
33  [1]=>
34  int(0)
35  [2]=>
36  int(0)
37  [3]=>
38  int(1)
39  [4]=>
40  int(0)
41  [5]=>
42  int(70)
43  [6]=>
44  int(4)
45  [7]=>
46  int(0)
47  [8]=>
48  int(0)
49}
50array(9) {
51  ["tm_sec"]=>
52  int(0)
53  ["tm_min"]=>
54  int(0)
55  ["tm_hour"]=>
56  int(0)
57  ["tm_mday"]=>
58  int(1)
59  ["tm_mon"]=>
60  int(0)
61  ["tm_year"]=>
62  int(70)
63  ["tm_wday"]=>
64  int(4)
65  ["tm_yday"]=>
66  int(0)
67  ["tm_isdst"]=>
68  int(0)
69}
70
71--Hexa-decimal 10--
72array(9) {
73  [0]=>
74  int(10)
75  [1]=>
76  int(0)
77  [2]=>
78  int(0)
79  [3]=>
80  int(1)
81  [4]=>
82  int(0)
83  [5]=>
84  int(70)
85  [6]=>
86  int(4)
87  [7]=>
88  int(0)
89  [8]=>
90  int(0)
91}
92array(9) {
93  ["tm_sec"]=>
94  int(10)
95  ["tm_min"]=>
96  int(0)
97  ["tm_hour"]=>
98  int(0)
99  ["tm_mday"]=>
100  int(1)
101  ["tm_mon"]=>
102  int(0)
103  ["tm_year"]=>
104  int(70)
105  ["tm_wday"]=>
106  int(4)
107  ["tm_yday"]=>
108  int(0)
109  ["tm_isdst"]=>
110  int(0)
111}
112
113--Hexa-decimal -10--
114array(9) {
115  [0]=>
116  int(50)
117  [1]=>
118  int(59)
119  [2]=>
120  int(23)
121  [3]=>
122  int(31)
123  [4]=>
124  int(11)
125  [5]=>
126  int(69)
127  [6]=>
128  int(3)
129  [7]=>
130  int(364)
131  [8]=>
132  int(0)
133}
134array(9) {
135  ["tm_sec"]=>
136  int(50)
137  ["tm_min"]=>
138  int(59)
139  ["tm_hour"]=>
140  int(23)
141  ["tm_mday"]=>
142  int(31)
143  ["tm_mon"]=>
144  int(11)
145  ["tm_year"]=>
146  int(69)
147  ["tm_wday"]=>
148  int(3)
149  ["tm_yday"]=>
150  int(364)
151  ["tm_isdst"]=>
152  int(0)
153}
154