1--TEST-- 2Test strftime() 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_ALL, "POSIX")) { 9 die("skip Locale POSIX is needed by test and is not available"); 10} 11?> 12--FILE-- 13<?php 14echo "*** Testing strftime() : usage variation ***\n"; 15 16// Initialise function arguments not being substituted (if any) 17setlocale(LC_ALL, "POSIX"); 18putenv("LC_ALL=POSIX"); 19date_default_timezone_set("Asia/Calcutta"); 20$timestamp = mktime(8, 8, 8, 8, 8, 2008); 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( strftime($value, $timestamp) ); 35} 36 37?> 38--EXPECT-- 39*** Testing strftime() : 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