1--TEST--
2Test strptime() function : basic functionality
3--SKIPIF--
4<?php
5if (!function_exists('strptime')) {
6    die("skip - strptime() function not available in this build");
7}
8if (PHP_OS == 'Darwin') die("skip - strptime() behaves differently on Darwin");
9if (!strftime('%Z')) die('skip strftime does not support %Z');
10?>
11--FILE--
12<?php
13$orig = setlocale(LC_ALL, 'C');
14date_default_timezone_set("GMT");
15
16echo "*** Testing strptime() : basic functionality ***\n";
17
18$input = "10:00:00 AM July 2 1963";
19$tstamp = strtotime($input);
20
21$str = strftime("%r %B%e %Y %Z", $tstamp);
22var_dump(strptime($str, '%H:%M:%S %p %B %d %Y'));
23
24$str = strftime("%T %D", $tstamp);
25var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
26
27$str = strftime("%A %B %e %R", $tstamp);
28var_dump(strptime($str, '%A %B %e %R'));
29
30setlocale(LC_ALL, $orig);
31?>
32--EXPECT--
33*** Testing strptime() : basic functionality ***
34array(9) {
35  ["tm_sec"]=>
36  int(0)
37  ["tm_min"]=>
38  int(0)
39  ["tm_hour"]=>
40  int(10)
41  ["tm_mday"]=>
42  int(2)
43  ["tm_mon"]=>
44  int(6)
45  ["tm_year"]=>
46  int(63)
47  ["tm_wday"]=>
48  int(2)
49  ["tm_yday"]=>
50  int(182)
51  ["unparsed"]=>
52  string(4) " GMT"
53}
54array(9) {
55  ["tm_sec"]=>
56  int(0)
57  ["tm_min"]=>
58  int(0)
59  ["tm_hour"]=>
60  int(10)
61  ["tm_mday"]=>
62  int(2)
63  ["tm_mon"]=>
64  int(6)
65  ["tm_year"]=>
66  int(163)
67  ["tm_wday"]=>
68  int(1)
69  ["tm_yday"]=>
70  int(182)
71  ["unparsed"]=>
72  string(0) ""
73}
74array(9) {
75  ["tm_sec"]=>
76  int(0)
77  ["tm_min"]=>
78  int(0)
79  ["tm_hour"]=>
80  int(10)
81  ["tm_mday"]=>
82  int(2)
83  ["tm_mon"]=>
84  int(6)
85  ["tm_year"]=>
86  int(0)
87  ["tm_wday"]=>
88  int(2)
89  ["tm_yday"]=>
90  int(182)
91  ["unparsed"]=>
92  string(0) ""
93}
94