public static function mapKeys(array $elements, $function)
    {
        $newArray = [];
        foreach ($elements as $oldKey => $value) {
            $newKey = Functions::call($function, $oldKey);
            $newArray[$newKey] = $value;
        }
        return $newArray;
    }
public static function mapKeys(array $elements, $function)
    {
        $newArray = [];
        foreach ($elements as $oldKey => $value) {
            $newKey = Functions::call($function, $oldKey);
            $newArray[$newKey] = $value;
        }
        return $newArray;
    }
public static function mapKeys ( array $ elements , $ function ) { $ newArray = [ ] ; foreach ( $ elements as $ oldKey => $ value ) { $ newKey = Functions :: call ( $ function , $ oldKey ) ; $ newArray [ $ newKey ] = $ value ; } return $ newArray ; }
This method maps array keys using the function.
Invokes the function for each key in the array. Creates a new array containing the keys returned by the function.

Example:
<code>
$array = array(
'k1' => 'v1',
'k2' => 'v2',
'k3' => 'v3'
);
$arrayWithNewKeys = Arrays::mapKeys($array, function ($key) {
return 'new_' . $key;
});
</code>
Result:
<code>
Array
(
[new_k1] => v1
[new_k2] => v2
[new_k3] => v3
)
</code>

@param array $elements
@param callable $function
@return array
This method maps array keys using the function . Invokes the function for each key in the array . Creates a new array containing the keys returned by the function .