1--TEST-- 2Test array_change_key_case() function : usage variations - referenced variables 3--INI-- 4allow_call_time_pass_reference=on 5--FILE-- 6<?php 7/* Prototype : array array_change_key_case(array $input [, int $case]) 8 * Description: Retuns an array with all string keys lowercased [or uppercased] 9 * Source code: ext/standard/array.c 10 */ 11 12/* 13 * Test array_change_key_case() when: 14 * 1. Passed a referenced variable 15 * 2. Passed an argument by reference 16 */ 17 18echo "*** Testing array_change_key_case() : usage variations ***\n"; 19 20$input = array('one' => 1, 'two' => 2, 'ABC' => 'xyz'); 21 22echo "\n-- \$input argument is a reference to array --\n"; 23$new_input = &$input; 24echo "Result:\n"; 25var_dump(array_change_key_case($new_input, CASE_UPPER)); 26echo "Original:\n"; 27var_dump($input); 28echo "Referenced:\n"; 29var_dump($new_input); 30 31echo "\n-- \$input is an array passed by reference --\n"; 32echo "Result:\n"; 33var_dump(array_change_key_case(&$input, CASE_UPPER)); 34echo "Original:\n"; 35var_dump($input); 36 37echo "Done"; 38?> 39 40--EXPECTF-- 41*** Testing array_change_key_case() : usage variations *** 42 43-- $input argument is a reference to array -- 44Result: 45array(3) { 46 ["ONE"]=> 47 int(1) 48 ["TWO"]=> 49 int(2) 50 ["ABC"]=> 51 string(3) "xyz" 52} 53Original: 54array(3) { 55 ["one"]=> 56 int(1) 57 ["two"]=> 58 int(2) 59 ["ABC"]=> 60 string(3) "xyz" 61} 62Referenced: 63array(3) { 64 ["one"]=> 65 int(1) 66 ["two"]=> 67 int(2) 68 ["ABC"]=> 69 string(3) "xyz" 70} 71 72-- $input is an array passed by reference -- 73Result: 74array(3) { 75 ["ONE"]=> 76 int(1) 77 ["TWO"]=> 78 int(2) 79 ["ABC"]=> 80 string(3) "xyz" 81} 82Original: 83array(3) { 84 ["one"]=> 85 int(1) 86 ["two"]=> 87 int(2) 88 ["ABC"]=> 89 string(3) "xyz" 90} 91Done 92 93