Home  >  Article  >  Backend Development  >  A brief discussion on php array array_change_key_case() function and array_chunk() function_php examples

A brief discussion on php array array_change_key_case() function and array_chunk() function_php examples

PHP中文网
PHP中文网Original
2016-12-05 13:28:171949browse

is as follows:

'Java',  
           'B'=>'Php',  
           'c'=>'C++',  
           'D'=>'C#'); 
print_r(array_change_key_case($input_array, CASE_LOWER)); 
print_r(array_change_key_case($input_array, CASE_UPPER)); 
//如果在运行该函数时两个或多个键相同,则最后的元素会覆盖其他元素,例如: 
$input_array = array('a'=>'Barcelona',  
           'B'=>'Madrid',  
           'c'=>'Manchester',  
           'b'=>'Milan'); 
print_r(array_change_key_case($input_array, CASE_LOWER)); 
?>

Running result:

'Java',  
           'B'=>'Php',  
           'C'=>'C++',  
           'D'=>'C#'); 
print_r(array_chunk($input_array, 2 ,false)); 
print_r(array_chunk($input_array, 3 ,true)); 
?>

Running result:

The above is what the editor brings to you Let’s briefly talk about the PHP array array_change_key_case() function and array_chunk() function. I hope everyone will support Script Home~

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn