1--TEST--
2Test gmstrftime() function : usage variation - Passing time related format strings to format argument.
3--FILE--
4<?php
5/* Prototype  : string gmstrftime(string format [, int timestamp])
6 * Description: Format a GMT/UCT time/date according to locale settings
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10
11echo "*** Testing gmstrftime() : usage variation ***\n";
12
13// Initialise function arguments not being substituted (if any)
14$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
15setlocale(LC_ALL, "en_US");
16date_default_timezone_set("Asia/Calcutta");
17
18//array of values to iterate over
19$inputs = array(
20	  'Hour as decimal by 24-hour format' => "%H",
21	  'Hour as decimal by 12-hour format' => "%I",
22	  'Minute as decimal number' => "%M",
23	  'AM/PM format for a time' => "%p",
24	  'Second as decimal number' => "%S",
25);
26
27// loop through each element of the array for timestamp
28
29foreach($inputs as $key =>$value) {
30      echo "\n--$key--\n";
31      var_dump( gmstrftime($value) );
32      var_dump( gmstrftime($value, $timestamp) );
33};
34
35?>
36===DONE===
37--EXPECTF--
38*** Testing gmstrftime() : usage variation ***
39
40--Hour as decimal by 24-hour format--
41string(2) "%d"
42string(2) "08"
43
44--Hour as decimal by 12-hour format--
45string(2) "%d"
46string(2) "08"
47
48--Minute as decimal number--
49string(%d) "%d"
50string(2) "08"
51
52--AM/PM format for a time--
53string(2) "%s"
54string(2) "AM"
55
56--Second as decimal number--
57string(%d) "%d"
58string(2) "08"
59===DONE===
60