Home > Backend Development > PHP Tutorial > 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中文网
Release: 2023-03-03 06:16:02
Original
1997 people have browsed it

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)); 
?>
Copy after login

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)); 
?>
Copy after login

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~

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template