I have an array like this:
array(
\'firstName\' => \'Joe\',
\'lastName\' => \'Smith\'
)
I need to loop over every elemen
You can't modify the keys in a foreach, so you would need to unset the old one and create a new one. Here is another way:
$array = array_combine(array_map('ucfirst', array_keys($array)), $array);
array_keysucfirst to the keys using array_maparray_combine