Annotation of embedaddon/php/ext/standard/tests/array/array_values_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_values() function : usage variations - Internal order check
3: --FILE--
4: <?php
5: /* Prototype : array array_values(array $input)
6: * Description: Return just the values from the input array
7: * Source code: ext/standard/array.c
8: */
9:
10: /*
11: * Check that array_values is re-assigning keys according to the internal order of the array,
12: * and is not dependant on the \$input argument's keys
13: */
14:
15: echo "*** Testing array_values() : usage variations ***\n";
16:
17: // populate array with 'default' keys in reverse order
18: $input = array(3 => 'three', 2 => 'two', 1 => 'one', 0 => 'zero');
19:
20: echo "\n-- \$input argument: --\n";
21: var_dump($input);
22:
23: echo "\n-- Result of array_values() --\n";
24: var_dump(array_values($input));
25:
26: echo "Done";
27: ?>
28:
29: --EXPECTF--
30: *** Testing array_values() : usage variations ***
31:
32: -- $input argument: --
33: array(4) {
34: [3]=>
35: string(5) "three"
36: [2]=>
37: string(3) "two"
38: [1]=>
39: string(3) "one"
40: [0]=>
41: string(4) "zero"
42: }
43:
44: -- Result of array_values() --
45: array(4) {
46: [0]=>
47: string(5) "three"
48: [1]=>
49: string(3) "two"
50: [2]=>
51: string(3) "one"
52: [3]=>
53: string(4) "zero"
54: }
55: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>