/hphp/test/zend/good/ext/standard/tests/array/array_unique_error.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
- <?hh
- /* Prototype : array array_unique(array $input)
- * Description: Removes duplicate values from array
- * Source code: ext/standard/array.c
- */
- <<__EntryPoint>> function main(): void {
- echo "*** Testing array_unique() : error conditions ***\n";
- // Zero arguments
- echo "\n-- Testing array_unique() function with zero arguments --\n";
- try { var_dump( array_unique() ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
- //Test array_unique with one more than the expected number of arguments
- echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
- $input = varray[1, 2];
- $extra_arg = 10;
- try { var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
- echo "Done";
- }