PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 22 lines | 11 code | 4 blank | 7 comment | 0 complexity | 84e75066bf1cf800845047986109983a MD5 | raw file
 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 {
 7echo "*** Testing array_unique() : basic functionality ***\n";
 8
 9// array with default keys
10$input = varray[1, 2, "1", '2'];
11var_dump( array_unique($input) );
12
13// associative array
14$input = darray["1" => "one", 1 => "one", 2 => "two", '2' => "two"];
15var_dump( array_unique($input) );
16
17// mixed array
18$input = darray["1" => "one", 0 => "two", 1 => "one", 2 => "two", 3 => "three"];
19var_dump( array_unique($input) );
20
21echo "Done";
22}