Skip to content
Discussion options

You must be logged in to vote

Can’t you just use a collection for that?

collect($names)->first(fn ($name) => $name === ‘ahmed’);

collect($names)->firstWhere(‘name’, ‘ahmed’);

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@amaelftah
Comment options

@ralphjsmit
Comment options

@amaelftah
Comment options

@shaedrich
Comment options

Answer selected by amaelftah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants