gmstrftime_variation5.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Passing date 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. 'Year as decimal number without a century' => "%y",
  13. 'Year as decimal number including the century' => "%Y",
  14. 'Time zone offset' => "%Z",
  15. 'Time zone offset' => "%z",
  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( gmstrftime($value) );
  21. var_dump( gmstrftime($value, $timestamp) );
  22. };
  23. ?>
  24. --EXPECTF--
  25. *** Testing gmstrftime() : usage variation ***
  26. --Year as decimal number without a century--
  27. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  28. string(%d) "%d"
  29. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  30. string(2) "08"
  31. --Year as decimal number including the century--
  32. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  33. string(%d) "%d"
  34. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  35. string(4) "2008"
  36. --Time zone offset--
  37. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  38. string(%s) "%s"
  39. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  40. string(%s) "%s"