Skip to content

Add find() method #2

@JarJak

Description

@JarJak
public function find(callable $comparator): ?mixed
{
    foreach ($this as $key => $item) {
        if ($comparator($item, $key)) {
            return $item;
        }
    }
    return null;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions