1--TEST--
2Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
3--SKIPIF--
4<?php
5if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
6    die("skip Test is not valid for Windows");
7}
8if (!setlocale(LC_TIME, "POSIX")) {
9    die("skip Locale POSIX is required to run this test");
10}
11?>
12--FILE--
13<?php
14/* Prototype  : string gmstrftime(string format [, int timestamp])
15 * Description: Format a GMT/UCT time/date according to locale settings
16 * Source code: ext/date/php_date.c
17 * Alias to functions:
18 */
19
20echo "*** Testing gmstrftime() : usage variation ***\n";
21
22// Initialise function arguments not being substituted (if any)
23$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
24setlocale(LC_TIME, "POSIX");
25putenv("LC_TIME=POSIX");
26date_default_timezone_set("Asia/Calcutta");
27
28//array of values to iterate over
29$inputs = array(
30      'Preferred date and time representation' => "%c",
31	  'Preferred date representation' => "%x",
32	  'Preferred time representation' => "%X",
33);
34
35// loop through each element of the array for timestamp
36
37foreach($inputs as $key =>$value) {
38      echo "\n--$key--\n";
39      var_dump( $value );
40      var_dump( gmstrftime($value, $timestamp) );
41};
42
43?>
44===DONE===
45--EXPECT--
46*** Testing gmstrftime() : usage variation ***
47
48--Preferred date and time representation--
49string(2) "%c"
50string(24) "Fri Aug  8 08:08:08 2008"
51
52--Preferred date representation--
53string(2) "%x"
54string(8) "08/08/08"
55
56--Preferred time representation--
57string(2) "%X"
58string(8) "08:08:08"
59===DONE===
60