xref: /PHP-5.5/ext/date/tests/localtime_basic.phpt (revision 49a6cc24)
1--TEST--
2Test localtime() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : array localtime([int timestamp [, bool associative_array]])
6 * Description: Returns the results of the C system call localtime as an associative array
7 * if the associative_array argument is set to 1 other wise it is a regular array
8 * Source code: ext/date/php_date.c
9 * Alias to functions:
10 */
11
12echo "*** Testing localtime() : basic functionality ***\n";
13
14date_default_timezone_set("UTC");
15
16// Initialise all required variables
17$timestamp = 10;
18$associative_array = true;
19
20// Calling localtime() with all possible arguments
21var_dump( localtime($timestamp, $associative_array) );
22
23// Calling localtime() with possible optional arguments
24var_dump( localtime($timestamp) );
25
26// Calling localtime() with mandatory arguments
27var_dump( localtime() );
28
29?>
30===DONE===
31--EXPECTF--
32*** Testing localtime() : basic functionality ***
33array(9) {
34  ["tm_sec"]=>
35  int(10)
36  ["tm_min"]=>
37  int(0)
38  ["tm_hour"]=>
39  int(0)
40  ["tm_mday"]=>
41  int(1)
42  ["tm_mon"]=>
43  int(0)
44  ["tm_year"]=>
45  int(70)
46  ["tm_wday"]=>
47  int(4)
48  ["tm_yday"]=>
49  int(0)
50  ["tm_isdst"]=>
51  int(0)
52}
53array(9) {
54  [0]=>
55  int(10)
56  [1]=>
57  int(0)
58  [2]=>
59  int(0)
60  [3]=>
61  int(1)
62  [4]=>
63  int(0)
64  [5]=>
65  int(70)
66  [6]=>
67  int(4)
68  [7]=>
69  int(0)
70  [8]=>
71  int(0)
72}
73array(9) {
74  [0]=>
75  int(%d)
76  [1]=>
77  int(%d)
78  [2]=>
79  int(%d)
80  [3]=>
81  int(%d)
82  [4]=>
83  int(%d)
84  [5]=>
85  int(%d)
86  [6]=>
87  int(%d)
88  [7]=>
89  int(%d)
90  [8]=>
91  int(%d)
92}
93===DONE===
94