How to change first char of each key in array?

arrays, php

Solution

It's not possible without creating a new array, but here's a funky one-liner you could use:

$array = array_combine(
    array_map('ucfirst', array_keys($array)), 
    array_values($array)
);

It breaks up the array into keys and values, transforms the keys and then glues the two pieces back together.

Problem

I have an array with all keys in lover case and i need to change them that the firs char would be in uppercase, like `ucfirs` function does. Is it possible without creating a new array?

Original source