idate_variation5.phpt 1020 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. Test idate() function : usage variation - Passing supported Time 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. 'Internet Time' => 'B',
  11. '12 hour format' => 'h',
  12. '24 hour format' => 'H',
  13. 'Minutes' => 'i',
  14. 'DST Activated' => 'I',
  15. 'Seconds' => 's',
  16. 'Seconds since Unix Epoch' => 'U',
  17. 'Time zone offset' => 'Z'
  18. );
  19. // loop through each element of the array for timestamp
  20. foreach($inputs as $key =>$value) {
  21. echo "\n--$key--\n";
  22. var_dump( idate($value) );
  23. };
  24. ?>
  25. --EXPECTF--
  26. *** Testing idate() : usage variation ***
  27. --Internet Time--
  28. int(%d)
  29. --12 hour format--
  30. int(%d)
  31. --24 hour format--
  32. int(%d)
  33. --Minutes--
  34. int(%d)
  35. --DST Activated--
  36. int(%d)
  37. --Seconds--
  38. int(%d)
  39. --Seconds since Unix Epoch--
  40. int(%d)
  41. --Time zone offset--
  42. int(%d)