1--TEST--
2Test strftime() function : usage variation - Passing date related format strings to format argument.
3--FILE--
4<?php
5/* Prototype  : string strftime(string format [, int timestamp])
6 * Description: Format a local time/date according to locale settings
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10
11echo "*** Testing strftime() : usage variation ***\n";
12
13// Initialise function arguments not being substituted (if any)
14setlocale(LC_ALL, "en_US");
15date_default_timezone_set("Asia/Calcutta");
16$timestamp = mktime(8, 8, 8, 8, 8, 2008);
17
18//array of values to iterate over
19$inputs = array(
20	  'Year as decimal number without a century' => "%y",
21	  'Year as decimal number including the century' => "%Y",
22	  'Time zone offset' => "%Z",
23	  'Time zone offset' => "%z",
24);
25
26// loop through each element of the array for timestamp
27
28foreach($inputs as $key =>$value) {
29      echo "\n--$key--\n";
30      var_dump( strftime($value) );
31      var_dump( strftime($value, $timestamp) );
32};
33
34?>
35===DONE===
36--EXPECTF--
37*** Testing strftime() : usage variation ***
38
39--Year as decimal number without a century--
40string(%d) "%d"
41string(2) "08"
42
43--Year as decimal number including the century--
44string(%d) "%d"
45string(4) "2008"
46
47--Time zone offset--
48string(%d) "%s"
49string(%d) "%s"
50===DONE===
51