gmstrftime_variation4.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Passing month 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 month name' => "%b",
  16. 'Full month name' => "%B",
  17. 'Month as decimal' => "%m",
  18. );
  19. // loop through each element of the array for timestamp
  20. foreach($inputs as $key =>$value) {
  21. echo "\n--$key--\n";
  22. var_dump( gmstrftime($value) );
  23. var_dump( gmstrftime($value, $timestamp) );
  24. };
  25. ?>
  26. ===DONE===
  27. --EXPECTF--
  28. *** Testing gmstrftime() : usage variation ***
  29. --Abbreviated month name--
  30. string(%d) "%s"
  31. string(3) "Aug"
  32. --Full month name--
  33. string(%d) "%s"
  34. string(6) "August"
  35. --Month as decimal--
  36. string(%d) "%d"
  37. string(2) "08"
  38. ===DONE===