/hphp/test/zend/good/ext/standard/tests/array/array_unique_basic.php
PHP | 22 lines | 11 code | 4 blank | 7 comment | 0 complexity | 84e75066bf1cf800845047986109983a 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() : basic functionality ***\n";
- // array with default keys
- $input = varray[1, 2, "1", '2'];
- var_dump( array_unique($input) );
- // associative array
- $input = darray["1" => "one", 1 => "one", 2 => "two", '2' => "two"];
- var_dump( array_unique($input) );
- // mixed array
- $input = darray["1" => "one", 0 => "two", 1 => "one", 2 => "two", 3 => "three"];
- var_dump( array_unique($input) );
- echo "Done";
- }