gmstrftime_variation3.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Passing week 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. echo "*** Testing gmstrftime() : usage variation ***\n";
  11. // Initialise function arguments not being substituted (if any)
  12. $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
  13. //array of values to iterate over
  14. $inputs = array(
  15. 'Abbreviated weekday name' => "%a",
  16. 'Full weekday name' => "%A",
  17. 'Week number of the year' => "%U",
  18. 'Week number of the year in decimal number' => "%W",
  19. );
  20. // loop through each element of the array for timestamp
  21. foreach($inputs as $key =>$value) {
  22. echo "\n--$key--\n";
  23. var_dump( gmstrftime($value) );
  24. var_dump( gmstrftime($value, $timestamp) );
  25. };
  26. ?>
  27. ===DONE===
  28. --EXPECTF--
  29. *** Testing gmstrftime() : usage variation ***
  30. --Abbreviated weekday name--
  31. string(%d) "%s"
  32. string(3) "Fri"
  33. --Full weekday name--
  34. string(%d) "%s"
  35. string(6) "Friday"
  36. --Week number of the year--
  37. string(%d) "%d"
  38. string(2) "31"
  39. --Week number of the year in decimal number--
  40. string(%d) "%d"
  41. string(2) "31"
  42. ===DONE===