Anemone::index()

Gets item position index in the data by key.

Table of Contents
  1. Description
  2. Example

Description

Anemone::index(string $key): ?int;

This method gets the position index of an item based on the key position in the data. If the key does not exist in the data, this method returns null.

Example

$anemone = new Anemone([
    'a' => 1,
    'b' => 2,
    'c' => 3,
    'd' => 4,
    'e' => 5
]);

$index = $anemone->index('c'); // Returns `2`

Anemone::any()

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

Anemone::index()

Gets item position index in the data by key.

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.