strftime_variation6.phpt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Test strftime() function : usage variation - Passing time related format strings to format argument.
  3. --FILE--
  4. <?php
  5. echo "*** Testing strftime() : usage variation ***\n";
  6. // Initialise function arguments not being substituted (if any)
  7. setlocale(LC_ALL, "en_US");
  8. date_default_timezone_set("Asia/Calcutta");
  9. $timestamp = mktime(18, 8, 8, 8, 8, 2008);
  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( strftime($value) );
  22. var_dump( strftime($value, $timestamp) );
  23. };
  24. ?>
  25. --EXPECTF--
  26. *** Testing strftime() : usage variation ***
  27. --Hour as decimal by 24-hour format--
  28. Deprecated: Function strftime() is deprecated in %s on line %d
  29. string(%d) "%d"
  30. Deprecated: Function strftime() is deprecated in %s on line %d
  31. string(2) "18"
  32. --Hour as decimal by 12-hour format--
  33. Deprecated: Function strftime() is deprecated in %s on line %d
  34. string(%d) "%d"
  35. Deprecated: Function strftime() is deprecated in %s on line %d
  36. string(2) "06"
  37. --Minute as decimal number--
  38. Deprecated: Function strftime() is deprecated in %s on line %d
  39. string(%d) "%d"
  40. Deprecated: Function strftime() is deprecated in %s on line %d
  41. string(2) "08"
  42. --AM/PM format for a time--
  43. Deprecated: Function strftime() is deprecated in %s on line %d
  44. string(%d) "%s"
  45. Deprecated: Function strftime() is deprecated in %s on line %d
  46. string(2) "PM"
  47. --Second as decimal number--
  48. Deprecated: Function strftime() is deprecated in %s on line %d
  49. string(%d) "%d"
  50. Deprecated: Function strftime() is deprecated in %s on line %d
  51. string(2) "08"