localtime_error.phpt 989 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test localtime() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : array localtime([int timestamp [, bool associative_array]])
  6. * Description: Returns the results of the C system call localtime as an associative array
  7. * if the associative_array argument is set to 1 other wise it is a regular array
  8. * Source code: ext/date/php_date.c
  9. * Alias to functions:
  10. */
  11. //Set the default time zone
  12. date_default_timezone_set("Europe/London");
  13. echo "*** Testing localtime() : error conditions ***\n";
  14. echo "\n-- Testing localtime() function with more than expected no. of arguments --\n";
  15. $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
  16. $assoc = true;
  17. $extra_arg = 10;
  18. var_dump( localtime($timestamp, $assoc, $extra_arg) );
  19. ?>
  20. ===DONE===
  21. --EXPECTF--
  22. *** Testing localtime() : error conditions ***
  23. -- Testing localtime() function with more than expected no. of arguments --
  24. Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
  25. bool(false)
  26. ===DONE===