freezemage0/array_find

Provides array_find function.

Installs: 838

Dependents: 2

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/freezemage0/array_find

1.0.1 2023-10-03 08:37 UTC

This package is auto-updated.

Last update: 2025-10-01 00:13:54 UTC


README

It's baffling that PHP in [current year] does not have a built-in array_find function, so here it is.

Usage

<?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

Also passes key associated with the value as a second parameter of a callback.