strftime_variation14.phpt 1.7 KB

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