nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
https://doc.nette.org/utils
Other
1.98k stars 147 forks source link

Added Arrays::find() method #305

Closed into-the-v0id closed 11 months ago

into-the-v0id commented 11 months ago

This PR adds the Arrays::find() helper. It's somewhat commonly used functionality and often inconvenient and unnecessarily verbose in raw PHP.

dg commented 11 months ago

Thanks, that's a useful feature.

I'm thinking about one thing. Probably the findLast() function would come in handy over time. What about utilizing the already existing first() and last() functions and just add an optional $callback parameter to them?