xref: /PHP-8.0/ext/date/tests/localtime_basic.phpt (revision b5c7a83d)
1--TEST--
2Test localtime() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing localtime() : basic functionality ***\n";
6
7date_default_timezone_set("UTC");
8
9// Initialise all required variables
10$timestamp = 10;
11$associative_array = true;
12
13// Calling localtime() with all possible arguments
14var_dump( localtime($timestamp, $associative_array) );
15
16// Calling localtime() with possible optional arguments
17var_dump( localtime($timestamp) );
18
19// Calling localtime() with mandatory arguments
20var_dump( localtime() );
21
22?>
23--EXPECTF--
24*** Testing localtime() : basic functionality ***
25array(9) {
26  ["tm_sec"]=>
27  int(10)
28  ["tm_min"]=>
29  int(0)
30  ["tm_hour"]=>
31  int(0)
32  ["tm_mday"]=>
33  int(1)
34  ["tm_mon"]=>
35  int(0)
36  ["tm_year"]=>
37  int(70)
38  ["tm_wday"]=>
39  int(4)
40  ["tm_yday"]=>
41  int(0)
42  ["tm_isdst"]=>
43  int(0)
44}
45array(9) {
46  [0]=>
47  int(10)
48  [1]=>
49  int(0)
50  [2]=>
51  int(0)
52  [3]=>
53  int(1)
54  [4]=>
55  int(0)
56  [5]=>
57  int(70)
58  [6]=>
59  int(4)
60  [7]=>
61  int(0)
62  [8]=>
63  int(0)
64}
65array(9) {
66  [0]=>
67  int(%d)
68  [1]=>
69  int(%d)
70  [2]=>
71  int(%d)
72  [3]=>
73  int(%d)
74  [4]=>
75  int(%d)
76  [5]=>
77  int(%d)
78  [6]=>
79  int(%d)
80  [7]=>
81  int(%d)
82  [8]=>
83  int(%d)
84}
85