1--TEST--
2Test gmdate() function : usage variation - Passing Time format options 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 * Alias to functions:
9 */
10
11echo "*** Testing gmdate() : usage variation ***\n";
12
13// Initialise all required variables
14date_default_timezone_set('UTC');
15$timestamp = mktime(8, 8, 8, 8, 8, 2008);
16
17$time_formats = array(
18
19      'Lowercase Ante meridiem and post meridiem' => 'a',
20	  'Uppercase Ante meridiem and post meridiem' => 'a',
21	  'Swatch Internet time' => 'B',
22	  '12-hour format without leading zeros' => 'g',
23	  '24-hour format without leading zeros' => 'G',
24	  '12-hour format with leading zeros' => 'h',
25	  '24-hour format with leading zeros' => 'H',
26	  'Minutes with leading zeros' => 'i',
27	  'Seconds with leading zeros' => 's',
28	  'Milliseconds' => 'u',
29);
30
31foreach($time_formats as $key =>$value) {
32      echo "\n--$key--\n";
33	  var_dump( gmdate($value) );
34	  var_dump( gmdate($value, $timestamp) );
35}
36
37?>
38===DONE===
39--EXPECTF--
40*** Testing gmdate() : usage variation ***
41
42--Lowercase Ante meridiem and post meridiem--
43string(2) "%s"
44string(2) "am"
45
46--Uppercase Ante meridiem and post meridiem--
47string(2) "%s"
48string(2) "am"
49
50--Swatch Internet time--
51string(%d) "%d"
52string(3) "380"
53
54--12-hour format without leading zeros--
55string(%d) "%d"
56string(1) "8"
57
58--24-hour format without leading zeros--
59string(%d) "%d"
60string(1) "8"
61
62--12-hour format with leading zeros--
63string(%d) "%d"
64string(2) "08"
65
66--24-hour format with leading zeros--
67string(2) "%d"
68string(2) "08"
69
70--Minutes with leading zeros--
71string(2) "%d"
72string(2) "08"
73
74--Seconds with leading zeros--
75string(2) "%d"
76string(2) "08"
77
78--Milliseconds--
79string(%d) "%d"
80string(6) "000000"
81===DONE===
82