[PHP-NOTES] note 130257 added to function.array-find

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
A simple fallback For older PHP versions, that do not have 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: 2003:c6:9f22:ab00:e767:459f:199a:22fb)
----
Manual Page -- https://php.net/manual/en/function.array-find.php
Edit        -- https://main.php.net/note/edit/130257
Del: integrated  -- https://main.php.net/note/delete/130257/integrated
Del: useless     -- https://main.php.net/note/delete/130257/useless
Del: bad code    -- https://main.php.net/note/delete/130257/bad+code
Del: spam        -- https://main.php.net/note/delete/130257/spam
Del: non-english -- https://main.php.net/note/delete/130257/non-english
Del: in docs     -- https://main.php.net/note/delete/130257/in+docs
Del: other reasons-- https://main.php.net/note/delete/130257
Reject      -- https://main.php.net/note/reject/130257
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.