Anemone::find()

Returns the first item in the data that passes the test.

Table of Contents
  1. Description
  2. Example

Description

Anemone::find(callable $fn): mixed;

This is the OOP style of function find(), implemented as a class method. It returns the first item in the provided data that satisfies the provided testing function. If no values satisfy the testing function, null is returned.

Example

$anemone = new Anemone([1, 2, 3, 4, 5]);

$found = $anemone->find(function ($v) {
    return $v > 3;
}); // Returns `4`

Anemone::any()

Checks if at least one item in the data passes the test.

Anemone::find()

Returns the first item in the data that passes the test.

Anemone::is()

Filters the data so that only items that pass the test are left.

Anemone::not()

Filters the data so that only items that do not pass the test are left.

Anemone::pluck()

Returns a new data set contains values from the key on every item.