| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
For older PHP versions, here's the proposed fallback from "mail at nititech dot de" with added PHPDoc if it's any use for you:
<?php
/**
* Porting of PHP 8.4 function
*
* @template TValue of mixed
* @template TKey of array-key
*
* @param array<TKey, TValue> $array
* @param callable(TValue $value, TKey $key): bool $callback
* @return ?TValue
*
* @see https://www.php.net/manual/en/function.array-find.php
*/
function array_find(array $array, callable $callback): mixed
{
foreach ($array as $key => $value) {
if ($callback($value, $key)) {
return $value;
}
}
return null;
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 107.189.8.70)
----
Manual Page -- https://php.net/manual/en/function.array-find.php
Edit -- https://main.php.net/note/edit/130366
Del: integrated -- https://main.php.net/note/delete/130366/integrated
Del: useless -- https://main.php.net/note/delete/130366/useless
Del: bad code -- https://main.php.net/note/delete/130366/bad+code
Del: spam -- https://main.php.net/note/delete/130366/spam
Del: non-english -- https://main.php.net/note/delete/130366/non-english
Del: in docs -- https://main.php.net/note/delete/130366/in+docs
Del: other reasons-- https://main.php.net/note/delete/130366
Reject -- https://main.php.net/note/reject/130366
Search -- https://main.php.net/manage/user-notes.php