strftime_variation22.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test strftime() 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_ALL, "POSIX")) {
  9. die("skip Locale POSIX is needed by test and is not available");
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. echo "*** Testing strftime() : usage variation ***\n";
  15. // Initialise function arguments not being substituted (if any)
  16. setlocale(LC_ALL, "POSIX");
  17. putenv("LC_ALL=POSIX");
  18. date_default_timezone_set("Asia/Calcutta");
  19. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  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( strftime($value, $timestamp) );
  30. }
  31. ?>
  32. --EXPECTF--
  33. *** Testing strftime() : usage variation ***
  34. --Preferred date and time representation--
  35. Deprecated: Function strftime() is deprecated in %s on line %d
  36. string(24) "Fri Aug 8 08:08:08 2008"
  37. --Preferred date representation--
  38. Deprecated: Function strftime() is deprecated in %s on line %d
  39. string(8) "08/08/08"
  40. --Preferred time representation--
  41. Deprecated: Function strftime() is deprecated in %s on line %d
  42. string(8) "08:08:08"