Annotation of embedaddon/php/ext/standard/tests/array/array_unique_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_unique() function : usage variations - array with reference variables
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: /*
11: * Testing the functionality of array_unique() by passing
12: * array having reference variables as values.
13: */
14:
15: echo "*** Testing array_unique() : array with reference variables for \$input argument ***\n";
16:
17: $value1 = 10;
18: $value2 = "hello";
19: $value3 = 0;
20: $value4 = &$value2;
21:
22: // input array containing elements as reference variables
23: $input = array(
24: 0 => 0,
25: 1 => &$value4,
26: 2 => &$value2,
27: 3 => "hello",
28: 4 => &$value3,
29: 5 => $value4
30: );
31:
32: var_dump( array_unique($input, SORT_STRING) );
33:
34: echo "Done";
35: ?>
36: --EXPECTF--
37: *** Testing array_unique() : array with reference variables for $input argument ***
38: array(2) {
39: [0]=>
40: int(0)
41: [1]=>
42: &%unicode|string%(5) "hello"
43: }
44: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>