xref: /PHP-5.5/ext/date/tests/strtotime3.phpt (revision f81134a9)
1--TEST--
2strtotime() function (32 bit)
3--SKIPIF--
4<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
5--FILE--
6<?php
7date_default_timezone_set('Europe/Lisbon');
8$time = 1150494719; // 16/June/2006
9
10$strs = array(
11	'',
12	" \t\r\n000",
13	'yesterday',
14	'22:49:12',
15	'22:49:12 bogusTZ',
16	'22.49.12.42GMT',
17	'22.49.12.42bogusTZ',
18	't0222',
19	't0222 t0222',
20	'022233',
21	'022233 bogusTZ',
22	'2-3-2004',
23	'2.3.2004',
24	'20060212T23:12:23UTC',
25	'20060212T23:12:23 bogusTZ',
26	'2006167', //pgydotd
27	'Jan-15-2006', //pgtextshort
28	'2006-Jan-15', //pgtextreverse
29	'10/Oct/2000:13:55:36 +0100', //clf
30	'10/Oct/2000:13:55:36 +00100', //clf
31	'2006',
32	'1986', // year
33	'JAN',
34	'January',
35);
36
37foreach ($strs as $str) {
38	$t = strtotime($str, $time);
39	if (is_integer($t)) {
40		var_dump(date(DATE_RFC2822, $t));
41	} else {
42		var_dump($t);
43	}
44}
45
46?>
47--EXPECT--
48bool(false)
49bool(false)
50string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
51string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
52bool(false)
53string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
54bool(false)
55string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
56bool(false)
57string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
58bool(false)
59string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
60string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
61string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
62bool(false)
63string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
64string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
65string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
66string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
67bool(false)
68string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
69string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
70string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
71string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
72