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