Released ArrayLookup 1.4.0
1.4.0
Add new Finder::rows()
with the functionality is to get rows data filtered found:
use ArrayLookup\Finder;
$data = [6, 7, 8, 9];
var_dump(Finder::rows(
$data,
static fn($datum): bool => $datum > 6
)); // [7, 8, 9]
// WITH key array included, pass $key variable as 2nd arg on filter to be used in filter
var_dump(Finder::rows(
$data,
static fn($datum, $key): bool => $datum > 6 && $key > 1
)); // [8, 9]
// ... with PRESERVE original key
var_dump(Finder::rows(
$data,
static fn ($datum): bool => $datum > 6,
true
)); // [1 => 7, 2 => 8, 3 => 9]