gmstrftime_variation22.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Checking Preferred date and time representation 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. if (!setlocale(LC_TIME, "POSIX")) {
  9. die("skip Locale POSIX is required to run this test");
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. echo "*** Testing gmstrftime() : usage variation ***\n";
  15. // Initialise function arguments not being substituted (if any)
  16. $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
  17. setlocale(LC_TIME, "POSIX");
  18. putenv("LC_TIME=POSIX");
  19. date_default_timezone_set("Asia/Calcutta");
  20. //array of values to iterate over
  21. $inputs = array(
  22. 'Preferred date and time representation' => "%c",
  23. 'Preferred date representation' => "%x",
  24. 'Preferred time representation' => "%X",
  25. );
  26. // loop through each element of the array for timestamp
  27. foreach($inputs as $key =>$value) {
  28. echo "\n--$key--\n";
  29. var_dump( gmstrftime($value, $timestamp) );
  30. };
  31. ?>
  32. --EXPECTF--
  33. *** Testing gmstrftime() : usage variation ***
  34. --Preferred date and time representation--
  35. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  36. string(24) "Fri Aug 8 08:08:08 2008"
  37. --Preferred date representation--
  38. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  39. string(8) "08/08/08"
  40. --Preferred time representation--
  41. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  42. string(8) "08:08:08"