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 (!strftime('%Z')) die('skip strftime does not support %Z');
9?>
10--FILE--
11<?php
12$orig = setlocale(LC_ALL, 'C');
13date_default_timezone_set("GMT");
14putenv("TZ=GMT");
15
16echo "*** Testing strptime() : basic functionality ***\n";
17
18$input = "10:01:20 AM July 2 1963";
19$tstamp = strtotime($input);
20
21$str = strftime("%r %B%e %Y %Z", $tstamp);
22$res = strptime($str, '%H:%M:%S %p %B %d %Y %Z');
23var_dump($res["tm_sec"]);
24var_dump($res["tm_min"]);
25var_dump($res["tm_hour"]);
26var_dump($res["tm_mday"]);
27var_dump($res["tm_mon"]);
28var_dump($res["tm_year"]);
29
30$str = strftime("%T %D", $tstamp);
31$res = strptime($str, '%H:%M:%S %m/%d/%y');
32var_dump($res["tm_sec"]);
33var_dump($res["tm_min"]);
34var_dump($res["tm_hour"]);
35var_dump($res["tm_mday"]);
36var_dump($res["tm_mon"]);
37var_dump($res["tm_year"]);
38
39$str = strftime("%A %B %e %R", $tstamp);
40$res = strptime($str, '%A %B %e %R');
41var_dump($res["tm_sec"]);
42var_dump($res["tm_min"]);
43var_dump($res["tm_hour"]);
44var_dump($res["tm_mday"]);
45var_dump($res["tm_mon"]);
46var_dump($res["tm_year"]);
47
48setlocale(LC_ALL, $orig);
49?>
50--EXPECT--
51*** Testing strptime() : basic functionality ***
52int(20)
53int(1)
54int(10)
55int(2)
56int(6)
57int(63)
58int(20)
59int(1)
60int(10)
61int(2)
62int(6)
63int(163)
64int(0)
65int(1)
66int(10)
67int(2)
68int(6)
69int(0)
70