1--TEST--
2Test gmdate() function : usage variation - Passing predefined constants to format argument.
3--FILE--
4<?php
5/* Prototype  : string gmdate(string format [, long timestamp])
6 * Description: Format a GMT date/time
7 * Source code: ext/date/php_date.c
8 */
9
10echo "*** Testing gmdate() : usage variation ***\n";
11
12// Initialise all required variables
13date_default_timezone_set('UTC');
14$timestamp = mktime(8, 8, 8, 8, 8, 2008);
15
16//array of values to iterate over
17$inputs = array(
18      // Predefined Date constants
19      'DATE_ATOM Constant' => DATE_ATOM,
20	  'DATE_COOKIE Constant' => DATE_COOKIE,
21	  'DATE_RFC822 Constant' => DATE_RFC822,
22	  'DATE_RFC850 Constant' => DATE_RFC850,
23	  'DATE_RFC1036 Constant' => DATE_RFC1036,
24	  'DATE_RFC1123 Constant' => DATE_RFC1123,
25	  'DATE_RFC2822 Constant' => DATE_RFC2822,
26	  'DATE_RFC3339 Constant' => DATE_RFC3339,
27	  'DATE_RSS Constant' => DATE_RSS,
28	  'DATE_W3C Constant' => DATE_W3C,
29);
30
31// loop through each element of the array for format
32foreach($inputs as $key =>$value) {
33      echo "\n--$key--\n";
34	  var_dump( gmdate($value, $timestamp) );
35	  var_dump( gmdate($value) );
36};
37
38?>
39===DONE===
40--EXPECTF--
41*** Testing gmdate() : usage variation ***
42
43--DATE_ATOM Constant--
44string(25) "2008-08-08T08:08:08+00:00"
45string(%d) "%s"
46
47--DATE_COOKIE Constant--
48string(32) "Friday, 08-Aug-2008 08:08:08 GMT"
49string(%d) "%s"
50
51--DATE_RFC822 Constant--
52string(29) "Fri, 08 Aug 08 08:08:08 +0000"
53string(%d) "%s"
54
55--DATE_RFC850 Constant--
56string(30) "Friday, 08-Aug-08 08:08:08 GMT"
57string(%d) "%s"
58
59--DATE_RFC1036 Constant--
60string(29) "Fri, 08 Aug 08 08:08:08 +0000"
61string(%d) "%s"
62
63--DATE_RFC1123 Constant--
64string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
65string(%d) "%s"
66
67--DATE_RFC2822 Constant--
68string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
69string(%d) "%s"
70
71--DATE_RFC3339 Constant--
72string(25) "2008-08-08T08:08:08+00:00"
73string(%d) "%s"
74
75--DATE_RSS Constant--
76string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
77string(%d) "%s"
78
79--DATE_W3C Constant--
80string(25) "2008-08-08T08:08:08+00:00"
81string(%d) "%s"
82===DONE===
83