1--TEST--
2Test gmstrftime() function : usage variation - Passing date related format strings to format argument.
3--FILE--
4<?php
5echo "*** Testing gmstrftime() : usage variation ***\n";
6
7// Initialise function arguments not being substituted (if any)
8$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
9setlocale(LC_ALL, "en_US");
10date_default_timezone_set("Asia/Calcutta");
11
12
13//array of values to iterate over
14$inputs = array(
15      'Year as decimal number without a century' => "%y",
16      'Year as decimal number including the century' => "%Y",
17      'Time zone offset' => "%Z",
18      'Time zone offset' => "%z",
19);
20
21// loop through each element of the array for timestamp
22
23foreach($inputs as $key =>$value) {
24      echo "\n--$key--\n";
25      var_dump( gmstrftime($value) );
26      var_dump( gmstrftime($value, $timestamp) );
27};
28
29?>
30--EXPECTF--
31*** Testing gmstrftime() : usage variation ***
32
33--Year as decimal number without a century--
34
35Deprecated: Function gmstrftime() is deprecated in %s on line %d
36string(%d) "%d"
37
38Deprecated: Function gmstrftime() is deprecated in %s on line %d
39string(2) "08"
40
41--Year as decimal number including the century--
42
43Deprecated: Function gmstrftime() is deprecated in %s on line %d
44string(%d) "%d"
45
46Deprecated: Function gmstrftime() is deprecated in %s on line %d
47string(4) "2008"
48
49--Time zone offset--
50
51Deprecated: Function gmstrftime() is deprecated in %s on line %d
52string(%s) "%s"
53
54Deprecated: Function gmstrftime() is deprecated in %s on line %d
55string(%s) "%s"
56