1--TEST--
2Test 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
16echo "*** Testing array_change_key_case() : usage variations ***\n";
17
18$input = array('one' => 1, 'two' => 2, 'ABC' => 'xyz');
19
20echo "\n-- \$input argument is a reference to array --\n";
21$new_input = &$input;
22echo "Result:\n";
23var_dump(array_change_key_case($new_input, CASE_UPPER));
24echo "Original:\n";
25var_dump($input);
26echo "Referenced:\n";
27var_dump($new_input);
28
29echo "Done";
30?>
31--EXPECTF--
32*** Testing array_change_key_case() : usage variations ***
33
34-- $input argument is a reference to array --
35Result:
36array(3) {
37  ["ONE"]=>
38  int(1)
39  ["TWO"]=>
40  int(2)
41  ["ABC"]=>
42  string(3) "xyz"
43}
44Original:
45array(3) {
46  ["one"]=>
47  int(1)
48  ["two"]=>
49  int(2)
50  ["ABC"]=>
51  string(3) "xyz"
52}
53Referenced:
54array(3) {
55  ["one"]=>
56  int(1)
57  ["two"]=>
58  int(2)
59  ["ABC"]=>
60  string(3) "xyz"
61}
62Done
63