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--EXPECTF--
51*** Testing strptime() : basic functionality ***
52
53Deprecated: Function strftime() is deprecated in %s on line %d
54
55Deprecated: Function strptime() is deprecated in %s on line %d
56int(20)
57int(1)
58int(10)
59int(2)
60int(6)
61int(63)
62
63Deprecated: Function strftime() is deprecated in %s on line %d
64
65Deprecated: Function strptime() is deprecated in %s on line %d
66int(20)
67int(1)
68int(10)
69int(2)
70int(6)
71int(163)
72
73Deprecated: Function strftime() is deprecated in %s on line %d
74
75Deprecated: Function strptime() is deprecated in %s on line %d
76int(0)
77int(1)
78int(10)
79int(2)
80int(6)
81int(0)
82