gmdate_variation3.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Test gmdate() function : usage variation - Passing numeric representation of day formats.
  3. --FILE--
  4. <?php
  5. echo "*** Testing gmdate() : usage variation ***\n";
  6. // Initialise all required variables
  7. date_default_timezone_set('UTC');
  8. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  9. //array of values to iterate over
  10. $inputs = array(
  11. 'Day with leading zeros' => 'd',
  12. 'Day without leading zeros' => 'j',
  13. 'ISO representation' => 'N',
  14. 'Numeric representation of day' => 'w',
  15. 'Day of the year' => '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( gmdate($value) );
  21. var_dump( gmdate($value, $timestamp) );
  22. };
  23. ?>
  24. --EXPECTF--
  25. *** Testing gmdate() : usage variation ***
  26. --Day with leading zeros--
  27. string(%d) "%d"
  28. string(2) "08"
  29. --Day without leading zeros--
  30. string(%d) "%d"
  31. string(1) "8"
  32. --ISO representation--
  33. string(%d) "%d"
  34. string(1) "5"
  35. --Numeric representation of day--
  36. string(%d) "%d"
  37. string(1) "5"
  38. --Day of the year--
  39. string(%d) "%d"
  40. string(3) "220"