Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Arr::keyMap() method #49421

Closed
wants to merge 6 commits into from
Closed

Add Arr::keyMap() method #49421

wants to merge 6 commits into from

Conversation

Muetze42
Copy link
Contributor

@Muetze42 Muetze42 commented Dec 18, 2023

Run a map over each of the keys in the array.

$array = [
    'Foo' => 1,
    'Bar' => 2,
];

return Arr::keyMap($array, 'strtolower');

Result:

$array = [
    'foo' => 1,
    'bar' => 2,
];

@taylorotwell
Copy link
Member

You can just use mapWithKeys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants