gmstrftime_variation6.phpt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Passing time related format strings to format argument.
  3. --FILE--
  4. <?php
  5. echo "*** Testing gmstrftime() : usage variation ***\n";
  6. // Initialise function arguments not being substituted (if any)
  7. $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
  8. setlocale(LC_ALL, "en_US");
  9. date_default_timezone_set("Asia/Calcutta");
  10. //array of values to iterate over
  11. $inputs = array(
  12. 'Hour as decimal by 24-hour format' => "%H",
  13. 'Hour as decimal by 12-hour format' => "%I",
  14. 'Minute as decimal number' => "%M",
  15. 'AM/PM format for a time' => "%p",
  16. 'Second as decimal number' => "%S",
  17. );
  18. // loop through each element of the array for timestamp
  19. foreach($inputs as $key =>$value) {
  20. echo "\n--$key--\n";
  21. var_dump( gmstrftime($value) );
  22. var_dump( gmstrftime($value, $timestamp) );
  23. };
  24. ?>
  25. --EXPECTF--
  26. *** Testing gmstrftime() : usage variation ***
  27. --Hour as decimal by 24-hour format--
  28. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  29. string(2) "%d"
  30. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  31. string(2) "08"
  32. --Hour as decimal by 12-hour format--
  33. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  34. string(2) "%d"
  35. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  36. string(2) "08"
  37. --Minute as decimal number--
  38. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  39. string(%d) "%d"
  40. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  41. string(2) "08"
  42. --AM/PM format for a time--
  43. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  44. string(2) "%s"
  45. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  46. string(2) "AM"
  47. --Second as decimal number--
  48. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  49. string(%d) "%d"
  50. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  51. string(2) "08"