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