strftime_variation21.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test strftime() function : usage variation - Checking Preferred date and time representation on Windows.
  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. 'Preferred date and time representation' => "%c",
  13. 'Preferred date representation' => "%x",
  14. 'Preferred time representation' => "%X",
  15. );
  16. // loop through each element of the array for timestamp
  17. foreach($inputs as $key =>$value) {
  18. echo "\n--$key--\n";
  19. var_dump( strftime($value) );
  20. var_dump( strftime($value, $timestamp) );
  21. }
  22. ?>
  23. --EXPECTF--
  24. *** Testing strftime() : usage variation ***
  25. --Preferred date and time representation--
  26. Deprecated: Function strftime() is deprecated in %s on line %d
  27. string(%d) "%s %s %d %d:%d:%d %d"
  28. Deprecated: Function strftime() is deprecated in %s on line %d
  29. string(24) "Fri Aug 8 08:08:08 2008"
  30. --Preferred date representation--
  31. Deprecated: Function strftime() is deprecated in %s on line %d
  32. string(%d) "%d/%d/%d"
  33. Deprecated: Function strftime() is deprecated in %s on line %d
  34. string(8) "08/08/08"
  35. --Preferred time representation--
  36. Deprecated: Function strftime() is deprecated in %s on line %d
  37. string(%d) "%d:%d:%d"
  38. Deprecated: Function strftime() is deprecated in %s on line %d
  39. string(8) "08:08:08"