Annotation of embedaddon/php/ext/date/tests/gmstrftime_variation5.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test gmstrftime() function : usage variation - Passing date related format strings to format argument.
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string gmstrftime(string format [, int timestamp])
                      6:  * Description: Format a GMT/UCT time/date according to locale settings 
                      7:  * Source code: ext/date/php_date.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: echo "*** Testing gmstrftime() : usage variation ***\n";
                     12: 
                     13: // Initialise function arguments not being substituted (if any)
                     14: $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
                     15: setlocale(LC_ALL, "en_US");
                     16: date_default_timezone_set("Asia/Calcutta");
                     17: 
                     18: 
                     19: //array of values to iterate over
                     20: $inputs = array(
                     21:          'Year as decimal number without a century' => "%y",
                     22:          'Year as decimal number including the century' => "%Y",
                     23:          'Time zone offset' => "%Z",           
                     24:          'Time zone offset' => "%z",
                     25: );
                     26: 
                     27: // loop through each element of the array for timestamp
                     28: 
                     29: foreach($inputs as $key =>$value) {
                     30:       echo "\n--$key--\n";
                     31:       var_dump( gmstrftime($value) );
                     32:       var_dump( gmstrftime($value, $timestamp) );
                     33: };
                     34: 
                     35: ?>
                     36: ===DONE===
                     37: --EXPECTF--
                     38: *** Testing gmstrftime() : usage variation ***
                     39: 
                     40: --Year as decimal number without a century--
                     41: string(%d) "%d"
                     42: string(2) "08"
                     43: 
                     44: --Year as decimal number including the century--
                     45: string(%d) "%d"
                     46: string(4) "2008"
                     47: 
                     48: --Time zone offset--
                     49: string(%s) "%s"
                     50: string(%s) "%s"
                     51: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>