PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/array/array_unique_error.php

http://github.com/facebook/hiphop-php
PHP | 20 lines | 11 code | 3 blank | 6 comment | 0 complexity | 83fb655b3de37fd593b793a0ab50d076 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?hh
  2. /* Prototype : array array_unique(array $input)
  3. * Description: Removes duplicate values from array
  4. * Source code: ext/standard/array.c
  5. */
  6. <<__EntryPoint>> function main(): void {
  7. echo "*** Testing array_unique() : error conditions ***\n";
  8. // Zero arguments
  9. echo "\n-- Testing array_unique() function with zero arguments --\n";
  10. try { var_dump( array_unique() ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
  11. //Test array_unique with one more than the expected number of arguments
  12. echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
  13. $input = varray[1, 2];
  14. $extra_arg = 10;
  15. try { var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
  16. echo "Done";
  17. }