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