gmdate_variation6.phpt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --TEST--
  2. Test gmdate() function : usage variation - Passing Month format options to format argument.
  3. --FILE--
  4. <?php
  5. /* Prototype : string gmdate(string format [, long timestamp])
  6. * Description: Format a GMT date/time
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing gmdate() : usage variation ***\n";
  11. // Initialise all required variables
  12. date_default_timezone_set('UTC');
  13. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  14. echo "\n-- Testing gmdate() function with full textual representation of month format --\n";
  15. var_dump( gmdate('F') );
  16. var_dump( gmdate('F', $timestamp) );
  17. echo "\n-- Testing gmdate() function with numeric representation of month format --\n";
  18. var_dump( gmdate('m') );
  19. var_dump( gmdate('m', $timestamp) );
  20. echo "\n-- Testing gmdate() function with short textual representation of month format --\n";
  21. var_dump( gmdate('M') );
  22. var_dump( gmdate('M', $timestamp) );
  23. echo "\n-- Testing gmdate() function with numeric representation of month without leading zeros format --\n";
  24. var_dump( gmdate('n') );
  25. var_dump( gmdate('n', $timestamp) );
  26. echo "\n-- Testing gmdate() function with number of days in a month format --\n";
  27. var_dump( gmdate('t') );
  28. var_dump( gmdate('t', $timestamp) );
  29. ?>
  30. ===DONE===
  31. --EXPECTF--
  32. *** Testing gmdate() : usage variation ***
  33. -- Testing gmdate() function with full textual representation of month format --
  34. string(%d) "%s"
  35. string(6) "August"
  36. -- Testing gmdate() function with numeric representation of month format --
  37. string(%d) "%d"
  38. string(2) "08"
  39. -- Testing gmdate() function with short textual representation of month format --
  40. string(%d) "%s"
  41. string(3) "Aug"
  42. -- Testing gmdate() function with numeric representation of month without leading zeros format --
  43. string(%d) "%d"
  44. string(1) "8"
  45. -- Testing gmdate() function with number of days in a month format --
  46. string(%d) "%d"
  47. string(2) "31"
  48. ===DONE===