xref: /PHP-8.4/ext/date/tests/strtotime2.phpt (revision e7e5f1f2)
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_ISO8601_EXPANDED',
14    'DATE_RFC822',
15    'DATE_RFC850',
16    'DATE_RFC1036',
17    'DATE_RFC1123',
18    'DATE_RFC2822',
19    'DATE_RFC3339',
20    'DATE_RFC3339_EXTENDED',
21    'DATE_RSS',
22    'DATE_W3C'
23);
24
25
26foreach ($constants as $const) {
27    echo "$const:\t";
28    echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n";
29}
30?>
31--EXPECT--
32DATE_ATOM:	OK
33DATE_COOKIE:	OK
34DATE_ISO8601:	OK
35DATE_ISO8601_EXPANDED:	OK
36DATE_RFC822:	OK
37DATE_RFC850:	OK
38DATE_RFC1036:	OK
39DATE_RFC1123:	OK
40DATE_RFC2822:	OK
41DATE_RFC3339:	OK
42DATE_RFC3339_EXTENDED:	OK
43DATE_RSS:	OK
44DATE_W3C:	OK
45