SplFixedArray

Implements\Iterator, \ArrayAccess, \Countable

The SplFixedArray class provides the main functionalities of array. The main differences between a SplFixedArray and a normal PHP array is that the SplFixedArray is of fixed length and allows only integers within the range as indexes. The advantage is that it allows a faster array implementation.

package

Default

Methods

SplFixedArray constructor.

__construct(integer $size)

Arguments

$size

integer

Do nothing.

__wakeup()

count

count(): integer

Response

integer

Return current array entry

current(): mixed
link

https://php.net/manual/en/splfixedarray.current.php

since 5.3.0

Response

mixed

The current element value.

fromArray

fromArray(array $array,boolean $save_indexes = true): \SplFixedArray
static
psalm-suppress

MixedAssignment

Arguments

$array

array

$save_indexes

boolean

Response

\SplFixedArray

getSize

getSize(): integer

Response

integer

Return current array index

key(): integer

Response

integer

The current array index.

next

next(): void

offsetExists

offsetExists(string|integer $index): boolean

Arguments

$index

string|integer

Response

boolean

offsetGet

offsetGet(string|integer $index): mixed

Arguments

$index

string|integer

Response

mixed

offsetSet

offsetSet(string|integer $index,mixed $newval)
psalm-suppress

MixedAssignment

Arguments

$index

string|integer

$newval

mixed

offsetUnset

offsetUnset(string|integer $index)

Arguments

$index

string|integer

Rewind iterator back to the start

rewind(): void

setSize

setSize(integer $size): boolean

Arguments

$size

integer

Response

boolean

toArray

toArray(): array

Response

array

Check whether the array contains more elements

valid(): boolean
link

https://php.net/manual/en/splfixedarray.valid.php

Response

boolean

true if the array contains any more elements, false otherwise.

Properties

mixed>

internalArray :\array<int,
var

mixed>

Type(s)

\array

size

size :integer
var

Type(s)

integer