Annotation of embedaddon/php/ext/date/tests/strftime_variation6.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test strftime() function : usage variation - Passing time related format strings to format argument.
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : string strftime(string format [, int timestamp])
! 6: * Description: Format a local time/date according to locale settings
! 7: * Source code: ext/date/php_date.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "*** Testing strftime() : usage variation ***\n";
! 12:
! 13: // Initialise function arguments not being substituted (if any)
! 14: setlocale(LC_ALL, "en_US");
! 15: date_default_timezone_set("Asia/Calcutta");
! 16: $timestamp = mktime(18, 8, 8, 8, 8, 2008);
! 17:
! 18:
! 19: //array of values to iterate over
! 20: $inputs = array(
! 21: 'Hour as decimal by 24-hour format' => "%H",
! 22: 'Hour as decimal by 12-hour format' => "%I",
! 23: 'Minute as decimal number' => "%M",
! 24: 'AM/PM format for a time' => "%p",
! 25: 'Second as decimal number' => "%S",
! 26: );
! 27:
! 28: // loop through each element of the array for timestamp
! 29:
! 30: foreach($inputs as $key =>$value) {
! 31: echo "\n--$key--\n";
! 32: var_dump( strftime($value) );
! 33: var_dump( strftime($value, $timestamp) );
! 34: };
! 35:
! 36: ?>
! 37: ===DONE===
! 38: --EXPECTF--
! 39: *** Testing strftime() : usage variation ***
! 40:
! 41: --Hour as decimal by 24-hour format--
! 42: string(%d) "%d"
! 43: string(2) "18"
! 44:
! 45: --Hour as decimal by 12-hour format--
! 46: string(%d) "%d"
! 47: string(2) "06"
! 48:
! 49: --Minute as decimal number--
! 50: string(%d) "%d"
! 51: string(2) "08"
! 52:
! 53: --AM/PM format for a time--
! 54: string(%d) "%s"
! 55: string(2) "PM"
! 56:
! 57: --Second as decimal number--
! 58: string(%d) "%d"
! 59: string(2) "08"
! 60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>