用于php的array_find。当找到第一个匹配项时停止线性搜索。
github.com/oliver-dvorski/array_find
源代码
问题
安装: 296
依赖: 0
建议: 0
安全: 0
星标: 0
关注者: 2
分支: 0
开放问题: 0
Requires
None
Requires (Dev)
Suggests
Provides
Conflicts
Replaces
MIT 41f181afb7f1fc8b65d85cb397a81d35b80054c9
This package is auto-updated.
Last update: 2024-09-16 12:33:26 UTC
使用composer install安装依赖。
composer install
您可以通过运行composer test脚本来确认程序是否按预期工作。
composer test
$people = [ ['name' => 'John', 'age' => 20], ['name' => 'Jane', 'age' => 21], ['name' => 'Jack', 'age' => 22], ]; // Returns ['name' => 'Jane', 'age' => 21] $found = array_find($people, fn($item) => $item['name'] === 'Jane');