1--TEST--
2Test date_create() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : bool checkdate  ( int $month  , int $day  , int $year  )
6 * Description: Checks the validity of the date formed by the arguments.
7 *              A date is considered valid if each parameter is properly defined.
8 * Source code: ext/date/php_date.c
9 */
10
11//Set the default time zone
12date_default_timezone_set("Europe/London");
13
14echo "*** Testing checkdate() : basic functionality ***\n";
15
16echo "-- The following are all valid dates --\n";
17var_dump( checkdate(1, 1, 2009) );
18var_dump( checkdate(12, 31, 2009) );
19var_dump( checkdate(7, 2, 1963) );
20var_dump( checkdate(5, 31, 2009) );
21var_dump( checkdate(2, 28, 2009) ); // non-leap year
22var_dump( checkdate(2, 29, 2008) ); // leap year
23var_dump( checkdate(7, 2, 1) );     // min year
24var_dump( checkdate(7, 2, 32767) ); // max year
25
26echo "-- The following are all invalid dates --\n";
27var_dump( checkdate(13, 1, 2009) );
28var_dump( checkdate(2, 31, 2009) );
29var_dump( checkdate(1, 32, 2009) );
30var_dump( checkdate(2, 29, 2009) ); // non-leap year
31var_dump( checkdate(7, 2, 32768) ); // >max year
32var_dump( checkdate(7, 2, 0) ); // <min year
33
34?>
35===DONE===
36--EXPECT--
37*** Testing checkdate() : basic functionality ***
38-- The following are all valid dates --
39bool(true)
40bool(true)
41bool(true)
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47-- The following are all invalid dates --
48bool(false)
49bool(false)
50bool(false)
51bool(false)
52bool(false)
53bool(false)
54===DONE===
55