Annotation of embedaddon/php/ext/standard/tests/array/array_change_key_case_variation7.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test array_change_key_case() function : usage variations - referenced variables
3: --FILE--
4: <?php
5: /* Prototype : array array_change_key_case(array $input [, int $case])
6: * Description: Retuns an array with all string keys lowercased [or uppercased]
7: * Source code: ext/standard/array.c
8: */
9:
10: /*
11: * Test array_change_key_case() when:
12: * 1. Passed a referenced variable
13: * 2. Passed an argument by reference
14: */
15:
16: echo "*** Testing array_change_key_case() : usage variations ***\n";
17:
18: $input = array('one' => 1, 'two' => 2, 'ABC' => 'xyz');
19:
20: echo "\n-- \$input argument is a reference to array --\n";
21: $new_input = &$input;
22: echo "Result:\n";
23: var_dump(array_change_key_case($new_input, CASE_UPPER));
24: echo "Original:\n";
25: var_dump($input);
26: echo "Referenced:\n";
27: var_dump($new_input);
28:
29: echo "Done";
30: ?>
31:
32: --EXPECTF--
33: *** Testing array_change_key_case() : usage variations ***
34:
35: -- $input argument is a reference to array --
36: Result:
37: array(3) {
38: ["ONE"]=>
39: int(1)
40: ["TWO"]=>
41: int(2)
42: ["ABC"]=>
43: string(3) "xyz"
44: }
45: Original:
46: array(3) {
47: ["one"]=>
48: int(1)
49: ["two"]=>
50: int(2)
51: ["ABC"]=>
52: string(3) "xyz"
53: }
54: Referenced:
55: array(3) {
56: ["one"]=>
57: int(1)
58: ["two"]=>
59: int(2)
60: ["ABC"]=>
61: string(3) "xyz"
62: }
63: Done
64:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>