You are here

public static function ArrayHelper::mapKeys in Helper 7

Applies the callback to the keys of the given array.

Parameters

callable $callback: Callback function to run for each key in the array.

array $array: An array to run through the callback function.

Return value

array Returns an array containing all the elements of $array after applying the callback function to each key.

1 call to ArrayHelper::mapKeys()
ArrayHelperTest::testMapKeys in tests/ArrayHelperTest.test

File

lib/ArrayHelper.php, line 73

Class

ArrayHelper

Code

public static function mapKeys($callback, array $array) {
  return array_combine(array_map($callback, array_combine(array_keys($array), array_keys($array))), $array);
}