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--
35
36Deprecated: Function strftime() is deprecated in %s on line %d
37string(%d) "%d"
38
39Deprecated: Function strftime() is deprecated in %s on line %d
40string(2) "18"
41
42--Hour as decimal by 12-hour format--
43
44Deprecated: Function strftime() is deprecated in %s on line %d
45string(%d) "%d"
46
47Deprecated: Function strftime() is deprecated in %s on line %d
48string(2) "06"
49
50--Minute as decimal number--
51
52Deprecated: Function strftime() is deprecated in %s on line %d
53string(%d) "%d"
54
55Deprecated: Function strftime() is deprecated in %s on line %d
56string(2) "08"
57
58--AM/PM format for a time--
59
60Deprecated: Function strftime() is deprecated in %s on line %d
61string(%d) "%s"
62
63Deprecated: Function strftime() is deprecated in %s on line %d
64string(2) "PM"
65
66--Second as decimal number--
67
68Deprecated: Function strftime() is deprecated in %s on line %d
69string(%d) "%d"
70
71Deprecated: Function strftime() is deprecated in %s on line %d
72string(2) "08"
73