gmstrftime_variation16.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --TEST--
  2. Test gmstrftime() function : usage variation - Checking time 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 gmstrftime() : usage variation ***\n";
  12. // Initialise function arguments not being substituted (if any)
  13. $timestamp = gmmktime(14, 8, 8, 8, 8, 2008);
  14. setlocale(LC_ALL, "en_US");
  15. date_default_timezone_set("Asia/Calcutta");
  16. //array of values to iterate over
  17. $inputs = array(
  18. 'Time in a.m/p.m notation' => "%r",
  19. 'Time in 24 hour notation' => "%R",
  20. 'Current time %H:%M:%S format' => "%T",
  21. );
  22. // loop through each element of the array for timestamp
  23. foreach($inputs as $key =>$value) {
  24. echo "\n--$key--\n";
  25. var_dump( gmstrftime($value) );
  26. var_dump( gmstrftime($value, $timestamp) );
  27. };
  28. ?>
  29. --EXPECTF--
  30. *** Testing gmstrftime() : usage variation ***
  31. --Time in a.m/p.m notation--
  32. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  33. string(%d) "%d:%d:%d %s"
  34. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  35. string(11) "02:08:08 PM"
  36. --Time in 24 hour notation--
  37. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  38. string(%d) "%d:%d"
  39. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  40. string(5) "14:08"
  41. --Current time %H:%M:%S format--
  42. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  43. string(%d) "%d:%d:%d"
  44. Deprecated: Function gmstrftime() is deprecated in %s on line %d
  45. string(8) "14:08:08"