idate_variation4.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Test idate() function : usage variation - Passing supported Date format characters to format argument.
  3. --FILE--
  4. <?php
  5. echo "*** Testing idate() : usage variation ***\n";
  6. // Initialise function arguments not being substituted (if any)
  7. date_default_timezone_set("Asia/Calcutta");
  8. //array of values to iterate over
  9. $inputs = array(
  10. 'Day of the month' => 'd',
  11. 'Leap Year' =>'L',
  12. 'Month number' => 'm',
  13. 'Days in the month' => 't',
  14. 'Day of the week' => 'w',
  15. 'ISO-8601 week number' => 'W',
  16. 'Year (1 or 2 digits)' => 'y',
  17. 'Year 4 digits' => 'Y',
  18. 'Day of the year' => 'z',
  19. );
  20. // loop through each element of the array for timestamp
  21. foreach($inputs as $key =>$value) {
  22. echo "\n--$key--\n";
  23. var_dump( idate($value) );
  24. };
  25. ?>
  26. --EXPECTF--
  27. *** Testing idate() : usage variation ***
  28. --Day of the month--
  29. int(%d)
  30. --Leap Year--
  31. int(%d)
  32. --Month number--
  33. int(%d)
  34. --Days in the month--
  35. int(%d)
  36. --Day of the week--
  37. int(%d)
  38. --ISO-8601 week number--
  39. int(%d)
  40. --Year (1 or 2 digits)--
  41. int(%d)
  42. --Year 4 digits--
  43. int(%d)
  44. --Day of the year--
  45. int(%d)