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 14/* Prototype : string strftime(string format [, int timestamp]) 15 * Description: Format a local time/date according to locale settings 16 * Source code: ext/date/php_date.c 17 * Alias to functions: 18 */ 19 20echo "*** Testing strftime() : usage variation ***\n"; 21 22// Initialise function arguments not being substituted (if any) 23setlocale(LC_ALL, "POSIX"); 24putenv("LC_ALL=POSIX"); 25date_default_timezone_set("Asia/Calcutta"); 26$timestamp = mktime(8, 8, 8, 8, 8, 2008); 27 28//array of values to iterate over 29$inputs = array( 30 'Preferred date and time representation' => "%c", 31 'Preferred date representation' => "%x", 32 'Preferred time representation' => "%X", 33); 34 35// loop through each element of the array for timestamp 36 37foreach($inputs as $key =>$value) { 38 echo "\n--$key--\n"; 39 var_dump( $value ); 40 var_dump( strftime($value, $timestamp) ); 41} 42 43?> 44===DONE=== 45--EXPECT-- 46*** Testing strftime() : usage variation *** 47 48--Preferred date and time representation-- 49string(2) "%c" 50string(24) "Fri Aug 8 08:08:08 2008" 51 52--Preferred date representation-- 53string(2) "%x" 54string(8) "08/08/08" 55 56--Preferred time representation-- 57string(2) "%X" 58string(8) "08:08:08" 59===DONE=== 60