Annotation of embedaddon/php/ext/standard/tests/array/array_unique_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_unique() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : array array_unique(array $input)
6: * Description: Removes duplicate values from array
7: * Source code: ext/standard/array.c
8: */
9:
10: echo "*** Testing array_unique() : basic functionality ***\n";
11:
12: // array with default keys
13: $input = array(1, 2, "1", '2');
14: var_dump( array_unique($input) );
15:
16: // associative array
17: $input = array("1" => "one", 1 => "one", 2 => "two", '2' => "two");
18: var_dump( array_unique($input) );
19:
20: // mixed array
21: $input = array("1" => "one", "two", "one", 2 => "two", "three");
22: var_dump( array_unique($input) );
23:
24: echo "Done";
25: ?>
26: --EXPECTF--
27: *** Testing array_unique() : basic functionality ***
28: array(2) {
29: [0]=>
30: int(1)
31: [1]=>
32: int(2)
33: }
34: array(2) {
35: [1]=>
36: string(3) "one"
37: [2]=>
38: string(3) "two"
39: }
40: array(3) {
41: [1]=>
42: string(3) "one"
43: [2]=>
44: string(3) "two"
45: [4]=>
46: string(5) "three"
47: }
48: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>