1--TEST--
2Test gmdate() function : usage variation - Passing numeric representation of day formats.
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
11//array of values to iterate over
12$inputs = array(
13
14     'Day with leading zeros' => 'd',
15     'Day without leading zeros' => 'j',
16     'ISO representation' => 'N',
17     'Numeric representation of day' => 'w',
18     'Day of the year' => '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( gmdate($value) );
26      var_dump( gmdate($value, $timestamp) );
27};
28
29?>
30--EXPECTF--
31*** Testing gmdate() : usage variation ***
32
33--Day with leading zeros--
34string(%d) "%d"
35string(2) "08"
36
37--Day without leading zeros--
38string(%d) "%d"
39string(1) "8"
40
41--ISO representation--
42string(%d) "%d"
43string(1) "5"
44
45--Numeric representation of day--
46string(%d) "%d"
47string(1) "5"
48
49--Day of the year--
50string(%d) "%d"
51string(3) "220"
52