Closed
Description
Description
Description
Add a new method called: "array_find"
This method could have the following signature:
function array_find(array $haystack, callable $callback): mixed {}
This method should have the same behavior as javascript's 'Array.prototype.find' method (mdn doc)
Example:
$data = ['dummy' => 'test',];
$keys = ['key1', 'dummy', 'key2'];
$result = array_find($keys, fn($key) => array_key_exists($key, $data));
echo $result;
// echo: dummy
PHP Version
N/A
Operating System
N/A
Thanks