1--TEST-- 2Test array_change_key_case() function - 2 3--FILE-- 4<?php 5 6$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); 7 8/* use 'case' argument other than CASE_LOWER & CASE_UPPER */ 9var_dump(array_change_key_case($item, "CASE_UPPER")); 10var_dump(array_change_key_case($item, 5)); 11 12/* when keys are different in terms of only case */ 13/* should return one value key pair with key being in lowercase */ 14var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); 15var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); 16 17/* should return one value key pair with key being in uppercase */ 18var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); 19var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) ); 20 21echo "end\n"; 22?> 23--EXPECTF-- 24Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d 25NULL 26array(4) { 27 ["ONE"]=> 28 int(1) 29 ["TWO"]=> 30 int(2) 31 ["THREE"]=> 32 int(3) 33 ["FOUR"]=> 34 string(4) "four" 35} 36array(1) { 37 ["one"]=> 38 int(4) 39} 40 41Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d 42NULL 43array(1) { 44 ["ONE"]=> 45 int(3) 46} 47array(1) { 48 ["ONE"]=> 49 int(2) 50} 51end 52