1--TEST-- 2Test gmstrftime() function : usage variation - Checking time related formats which are supported other than on Windows. 3--SKIPIF-- 4<?php 5if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { 6 die("skip Test is not valid for Windows"); 7} 8?> 9--FILE-- 10<?php 11/* Prototype : string gmstrftime(string format [, int timestamp]) 12 * Description: Format a GMT/UCT time/date according to locale settings 13 * Source code: ext/date/php_date.c 14 * Alias to functions: 15 */ 16 17echo "*** Testing gmstrftime() : usage variation ***\n"; 18 19// Initialise function arguments not being substituted (if any) 20$timestamp = gmmktime(14, 8, 8, 8, 8, 2008); 21setlocale(LC_ALL, "en_US"); 22date_default_timezone_set("Asia/Calcutta"); 23 24//array of values to iterate over 25$inputs = array( 26 'Time in a.m/p.m notation' => "%r", 27 'Time in 24 hour notation' => "%R", 28 'Current time %H:%M:%S format' => "%T", 29); 30 31// loop through each element of the array for timestamp 32 33foreach($inputs as $key =>$value) { 34 echo "\n--$key--\n"; 35 var_dump( gmstrftime($value) ); 36 var_dump( gmstrftime($value, $timestamp) ); 37}; 38 39?> 40===DONE=== 41--EXPECTF-- 42*** Testing gmstrftime() : usage variation *** 43 44--Time in a.m/p.m notation-- 45string(%d) "%d:%d:%d %s" 46string(11) "02:08:08 PM" 47 48--Time in 24 hour notation-- 49string(%d) "%d:%d" 50string(5) "14:08" 51 52--Current time %H:%M:%S format-- 53string(%d) "%d:%d:%d" 54string(8) "14:08:08" 55===DONE=== 56