1--TEST-- 2Test 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 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 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 29foreach($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-- 41string(%d) "%d" 42string(2) "08" 43 44--Day without leading zeros-- 45string(%d) "%d" 46string(1) "8" 47 48--ISO representation-- 49string(%d) "%d" 50string(1) "5" 51 52--Numeric representation of day-- 53string(%d) "%d" 54string(1) "5" 55 56--Day of the year-- 57string(%d) "%d" 58string(3) "220" 59===DONE=== 60