1--TEST-- 2Test gmstrftime() function : usage variation - Checking Preferred date and time representation 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} 8if (!setlocale(LC_TIME, "POSIX")) { 9 die("skip Locale POSIX is required to run this test"); 10} 11?> 12--FILE-- 13<?php 14echo "*** Testing gmstrftime() : usage variation ***\n"; 15 16// Initialise function arguments not being substituted (if any) 17$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); 18setlocale(LC_TIME, "POSIX"); 19putenv("LC_TIME=POSIX"); 20date_default_timezone_set("Asia/Calcutta"); 21 22//array of values to iterate over 23$inputs = array( 24 'Preferred date and time representation' => "%c", 25 'Preferred date representation' => "%x", 26 'Preferred time representation' => "%X", 27); 28 29// loop through each element of the array for timestamp 30 31foreach($inputs as $key =>$value) { 32 echo "\n--$key--\n"; 33 var_dump( $value ); 34 var_dump( gmstrftime($value, $timestamp) ); 35}; 36 37?> 38--EXPECT-- 39*** Testing gmstrftime() : usage variation *** 40 41--Preferred date and time representation-- 42string(2) "%c" 43string(24) "Fri Aug 8 08:08:08 2008" 44 45--Preferred date representation-- 46string(2) "%x" 47string(8) "08/08/08" 48 49--Preferred time representation-- 50string(2) "%X" 51string(8) "08:08:08" 52