Example 1 — Lowercase and Uppercase Keys
By default the keys become lowercase. Pass CASE_UPPER to make them uppercase.
<?php
$user = ['Name' => 'Asha', 'CITY' => 'Pune'];
print_r(array_change_key_case($user));
print_r(array_change_key_case($user, CASE_UPPER)); How It Works
- $user has the mixed case keys 'Name' and 'CITY'.
- The first call uses the default CASE_LOWER, so the keys become 'name' and 'city'.
- The second call passes CASE_UPPER, so the keys become 'NAME' and 'CITY'.
- The values 'Asha' and 'Pune' stay the same in both results.

