Anemone::offsetExists()

Checks if an item with a certain key/index exists in the data.

Table of Contents
  1. Description
  2. Example

Description

Anemone::offsetExists(mixed $key): bool;

This method is a requirement to be able to implement the ArrayAccess interface and aims to make the object data accessible using array access syntax. You won’t use this method directly, it will be executed automatically when you try to check the existence of an item with array access syntax. This method checks if an item with a certain key/index exists in the data and will only work when checked using empty() or isset() language construct.

Example

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

test(empty($anemone[0])); // Returns `true`
test(empty($anemone[1])); // Returns `false`
test(isset($anemone[1])); // Returns `true`

Anemone::any()

Checks if at least one item in the data 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::offsetExists()

Checks if an item with a certain key/index exists in the data.

Anemone::pluck()

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