compact_error.phpt 705 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Test compact() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : proto array compact(mixed var_names [, mixed ...])
  6. * Description: Creates a hash containing variables and their values
  7. * Source code: ext/standard/array.c
  8. * Alias to functions:
  9. */
  10. /*
  11. * Error -tests test compact with zero arguments.
  12. */
  13. echo "*** Testing compact() : error conditions ***\n";
  14. // Zero arguments
  15. echo "\n-- Testing compact() function with Zero arguments --\n";
  16. var_dump( compact() );
  17. echo "Done";
  18. ?>
  19. --EXPECTF--
  20. *** Testing compact() : error conditions ***
  21. -- Testing compact() function with Zero arguments --
  22. Warning: compact() expects at least 1 parameter, 0 given in %s on line %d
  23. NULL
  24. Done