Return to array_change_key_case_variation.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test 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 */ 9: var_dump(array_change_key_case($item, "CASE_UPPER")); 10: var_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 */ 14: var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); 15: var_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 */ 18: var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); 19: var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) ); 20: 21: echo "end\n"; 22: ?> 23: --EXPECTF-- 24: Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d 25: NULL 26: array(4) { 27: ["ONE"]=> 28: int(1) 29: ["TWO"]=> 30: int(2) 31: ["THREE"]=> 32: int(3) 33: ["FOUR"]=> 34: string(4) "four" 35: } 36: array(1) { 37: ["one"]=> 38: int(4) 39: } 40: 41: Warning: array_change_key_case() expects parameter 2 to be long, string given in %s on line %d 42: NULL 43: array(1) { 44: ["ONE"]=> 45: int(3) 46: } 47: array(1) { 48: ["ONE"]=> 49: int(2) 50: } 51: end