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_FAMILY == 'Darwin' || PHP_OS_FAMILY == 'BSD') {
9    die("skip strptime() behaves differently on Darwin/BSD");
10}
11if (!@strftime('%Z')) die('skip strftime does not support %Z');
12?>
13--FILE--
14<?php
15$orig = setlocale(LC_ALL, 'C');
16date_default_timezone_set("GMT");
17
18echo "*** Testing strptime() : basic functionality ***\n";
19
20$input = "10:00:00 AM July 2 1963";
21$tstamp = strtotime($input);
22
23$str = strftime("%r %B%e %Y %Z", $tstamp);
24var_dump(strptime($str, '%H:%M:%S %p %B %d %Y'));
25
26$str = strftime("%T %D", $tstamp);
27var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
28
29$str = strftime("%A %B %e %R", $tstamp);
30var_dump(strptime($str, '%A %B %e %R'));
31
32setlocale(LC_ALL, $orig);
33?>
34--EXPECTF--
35*** Testing strptime() : basic functionality ***
36
37Deprecated: Function strftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in %s on line %d
38
39Deprecated: Function strptime() is deprecated since 8.2, use date_parse_from_format() (for locale-independent parsing), or IntlDateFormatter::parse() (for locale-dependent parsing) instead in %s on line %d
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}
60
61Deprecated: Function strftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in %s on line %d
62
63Deprecated: Function strptime() is deprecated since 8.2, use date_parse_from_format() (for locale-independent parsing), or IntlDateFormatter::parse() (for locale-dependent parsing) instead in %s on line %d
64array(9) {
65  ["tm_sec"]=>
66  int(0)
67  ["tm_min"]=>
68  int(0)
69  ["tm_hour"]=>
70  int(10)
71  ["tm_mday"]=>
72  int(2)
73  ["tm_mon"]=>
74  int(6)
75  ["tm_year"]=>
76  int(163)
77  ["tm_wday"]=>
78  int(1)
79  ["tm_yday"]=>
80  int(182)
81  ["unparsed"]=>
82  string(0) ""
83}
84
85Deprecated: Function strftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in %s on line %d
86
87Deprecated: Function strptime() is deprecated since 8.2, use date_parse_from_format() (for locale-independent parsing), or IntlDateFormatter::parse() (for locale-dependent parsing) instead in %s on line %d
88array(9) {
89  ["tm_sec"]=>
90  int(0)
91  ["tm_min"]=>
92  int(0)
93  ["tm_hour"]=>
94  int(10)
95  ["tm_mday"]=>
96  int(2)
97  ["tm_mon"]=>
98  int(6)
99  ["tm_year"]=>
100  int(0)
101  ["tm_wday"]=>
102  int(2)
103  ["tm_yday"]=>
104  int(182)
105  ["unparsed"]=>
106  string(0) ""
107}
108