Introduction to the php array array_change_key_case () function and the array_chunk () function, arraychunk
As follows:
<? Php/* array_change_key_case () returns an array with uppercase or lowercase keys. Array array_change_key_case (array input [, int case]) parameter description: array is an array of key values to be converted. There are two options: CASE_LOWER. the default option is to return the key CASE_UPPER of the array with lowercase letters, returns the array key with uppercase letters */$ input_array = array ('A' => '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); // if two or more keys are the same when running the function, the final element will overwrite other elements, for example: $ input_array = array ('A' => 'barri ',' B '=> 'Madrid', 'c' => 'manchester ',' B '=> 'milance'); print_r (array_change_key_case ($ input_array, CASE_LOWER);?>
Running result:
<? Php/* array_chunk () Splits an array into a new array block. The parameter description of array array_chunk (array $ array, int $ size [, bool preserve_key]) is as follows: array is the size of the split array, which specifies the elements contained in each new array. The last array may contain several fewer elements: preserve_key: (optional) there are two options: true, retain the key name in the original array; false, default option. Each result array uses A new array index starting from 0 */$ input_array = array ('A' => '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 a brief introduction to the php array array_change_key_case () function and the array_chunk () function ~