Annotation of embedaddon/php/ext/date/tests/gmdate_variation3.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test gmdate() function : usage variation - Passing numeric representation of day formats.
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:
11: echo "*** Testing gmdate() : usage variation ***\n";
12:
13: // Initialise all required variables
14: date_default_timezone_set('UTC');
15: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
16:
17: //array of values to iterate over
18: $inputs = array(
19:
20: 'Day with leading zeros' => 'd',
21: 'Day without leading zeros' => 'j',
22: 'ISO representation' => 'N',
23: 'Numeric representation of day' => 'w',
24: 'Day of the year' => 'z'
25: );
26:
27: // loop through each element of the array for timestamp
28:
29: foreach($inputs as $key =>$value) {
30: echo "\n--$key--\n";
31: var_dump( gmdate($value) );
32: var_dump( gmdate($value, $timestamp) );
33: };
34:
35: ?>
36: ===DONE===
37: --EXPECTF--
38: *** Testing gmdate() : usage variation ***
39:
40: --Day with leading zeros--
41: string(%d) "%d"
42: string(2) "08"
43:
44: --Day without leading zeros--
45: string(%d) "%d"
46: string(1) "8"
47:
48: --ISO representation--
49: string(%d) "%d"
50: string(1) "5"
51:
52: --Numeric representation of day--
53: string(%d) "%d"
54: string(1) "5"
55:
56: --Day of the year--
57: string(%d) "%d"
58: string(3) "220"
59: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>