Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add new method: array_find #13996

Copy link
Copy link
@nicoalonso

Description

@nicoalonso
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.