strftime_variation13.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. Test strftime() function : usage variation - Checking date related formats which was not supported on Windows before VC14.
  3. --FILE--
  4. <?php
  5. echo "*** Testing strftime() : usage variation ***\n";
  6. // Initialise function arguments not being substituted (if any)
  7. setlocale(LC_ALL, "C");
  8. date_default_timezone_set("Asia/Calcutta");
  9. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  10. //array of values to iterate over
  11. $inputs = array(
  12. 'Century number' => "%C",
  13. 'Month Date Year' => "%D",
  14. 'Year with century' => "%G",
  15. 'Year without century' => "%g",
  16. );
  17. // loop through each element of the array for timestamp
  18. foreach($inputs as $key =>$value) {
  19. echo "\n--$key--\n";
  20. var_dump( strftime($value) );
  21. var_dump( strftime($value, $timestamp) );
  22. }
  23. ?>
  24. --EXPECTF--
  25. *** Testing strftime() : usage variation ***
  26. --Century number--
  27. Deprecated: Function strftime() is deprecated in %s on line %d
  28. string(2) "20"
  29. Deprecated: Function strftime() is deprecated in %s on line %d
  30. string(2) "20"
  31. --Month Date Year--
  32. Deprecated: Function strftime() is deprecated in %s on line %d
  33. string(%d) "%d/%d/%d"
  34. Deprecated: Function strftime() is deprecated in %s on line %d
  35. string(8) "08/08/08"
  36. --Year with century--
  37. Deprecated: Function strftime() is deprecated in %s on line %d
  38. string(4) "%d"
  39. Deprecated: Function strftime() is deprecated in %s on line %d
  40. string(4) "2008"
  41. --Year without century--
  42. Deprecated: Function strftime() is deprecated in %s on line %d
  43. string(2) "%d"
  44. Deprecated: Function strftime() is deprecated in %s on line %d
  45. string(2) "08"