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