1--TEST--
2Test gmdate() function : usage variation - Passing Year format options to format argument.
3--FILE--
4<?php
5/* Prototype  : string gmdate(string format [, long timestamp])
6 * Description: Format a GMT date/time
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10
11echo "*** Testing gmdate() : usage variation ***\n";
12
13// Initialise all required variables
14date_default_timezone_set('UTC');
15$timestamp = mktime(8, 8, 8, 8, 8, 2008);
16$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
17
18echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
19var_dump( gmdate('L', $timestamp_non_leap_year) );
20
21echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
22var_dump( gmdate('L') );
23var_dump( gmdate('L', $timestamp) );
24
25echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
26var_dump( gmdate('o') );
27var_dump( gmdate('o', $timestamp) );
28
29echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
30var_dump( gmdate('Y') );
31var_dump( gmdate('Y', $timestamp) );
32
33echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
34var_dump( gmdate('y') );
35var_dump( gmdate('y', $timestamp) );
36
37?>
38===DONE===
39--EXPECTF--
40*** Testing gmdate() : usage variation ***
41
42-- Testing gmdate() function with checking non leap year using Leap Year format --
43string(1) "0"
44
45-- Testing gmdate() function with checking leap year using Leap Year format --
46string(1) "%d"
47string(1) "1"
48
49-- Testing gmdate() function with ISO-8601 year number format --
50string(4) "%d"
51string(4) "2008"
52
53-- Testing gmdate() function with full numeric representation of year format --
54string(4) "%d"
55string(4) "2008"
56
57-- Testing gmdate() function with 2 digit representation year format --
58string(2) "%d"
59string(2) "08"
60===DONE===
61