class GenericArray extends AbstractArray (View source)

GenericArray represents a standard array object.

Properties

protected array $data The items of this array. from AbstractArray

Methods

__construct(array $data = [])

Constructs a new array object.

getIterator()

Returns an iterator for this array.

bool
offsetExists(mixed $offset)

Returns true if the given offset exists in this array.

mixed|null
offsetGet(mixed $offset)

Returns the value at the specified offset.

void
offsetSet(mixed|null $offset, mixed $value)

Sets the given value to the given offset in the array.

void
offsetUnset(mixed $offset)

Removes the given offset and its value from the array.

string
serialize()

Returns a serialized string representation of this array object.

void
unserialize(string $serialized)

Converts a serialized string representation into an instance object.

int
count()

Returns the number of items in this array.

void
clear()

Removes all items from this array.

array
toArray()

Returns a native PHP array representation of this array object.

bool
isEmpty()

Returns true if this array is empty.

Details

__construct(array $data = [])

Constructs a new array object.

Parameters

array $data The initial items to add to this array.

Traversable getIterator()

Returns an iterator for this array.

Return Value

Traversable

bool offsetExists(mixed $offset)

Returns true if the given offset exists in this array.

Parameters

mixed $offset The offset to check.

Return Value

bool

mixed|null offsetGet(mixed $offset)

Returns the value at the specified offset.

Parameters

mixed $offset The offset for which a value should be returned.

Return Value

mixed|null the value stored at the offset, or null if the offset does not exist.

void offsetSet(mixed|null $offset, mixed $value)

Sets the given value to the given offset in the array.

Parameters

mixed|null $offset The offset to set. If null, the value may be set at a numerically-indexed offset.
mixed $value The value to set at the given offset.

Return Value

void

void offsetUnset(mixed $offset)

Removes the given offset and its value from the array.

Parameters

mixed $offset The offset to remove from the array.

Return Value

void

string serialize()

Returns a serialized string representation of this array object.

Return Value

string a PHP serialized string.

void unserialize(string $serialized)

Converts a serialized string representation into an instance object.

Parameters

string $serialized A PHP serialized string to unserialize.

Return Value

void

int count()

Returns the number of items in this array.

Return Value

int

void clear()

Removes all items from this array.

Return Value

void

array toArray()

Returns a native PHP array representation of this array object.

Return Value

array

bool isEmpty()

Returns true if this array is empty.

Return Value

bool