提供 array_find 函数。
github.com/freezemage0/array_find
源代码
问题
安装: 354
依赖: 1
建议: 0
安全性: 0
星标: 2
关注者: 1
分支: 1
开放问题: 1
Requires
Requires (Dev)
Suggests
None
Provides
Conflicts
Replaces
proprietary e901a1b02e31048b977dcf8d0088babf6fbd3771
This package is auto-updated.
Last update: 2024-09-03 10:25:27 UTC
令人费解的是,在 [当前年份] 的 PHP 中没有内置的 array_find 函数,所以这里有它。
array_find
<?php use function Freezemage\ArrayUtils\find as array_find; $items = [1, 2, 3]; array_find($items, fn (int $item): bool => $item % 2 === 0); // prints 2
同时将与值关联的键作为回调函数的第二个参数传递。