xref: /PHP-8.0/ext/date/tests/strtotime2.phpt (revision f8d79582)
1--TEST--
2strtotime() on date constants
3--FILE--
4<?php
5
6date_default_timezone_set("Europe/Oslo");
7$time = time();
8
9$constants = array(
10    'DATE_ATOM',
11    'DATE_COOKIE',
12    'DATE_ISO8601',
13    'DATE_RFC822',
14    'DATE_RFC850',
15    'DATE_RFC1036',
16    'DATE_RFC1123',
17    'DATE_RFC2822',
18    'DATE_RFC3339',
19    'DATE_RSS',
20    'DATE_W3C'
21);
22
23
24foreach ($constants as $const) {
25    echo "$const:\t";
26    echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n";
27}
28?>
29--EXPECT--
30DATE_ATOM:	OK
31DATE_COOKIE:	OK
32DATE_ISO8601:	OK
33DATE_RFC822:	OK
34DATE_RFC850:	OK
35DATE_RFC1036:	OK
36DATE_RFC1123:	OK
37DATE_RFC2822:	OK
38DATE_RFC3339:	OK
39DATE_RSS:	OK
40DATE_W3C:	OK
41