class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable (View source)

Constants

IT_MODE_LIFO

IT_MODE_FIFO

IT_MODE_DELETE

IT_MODE_KEEP

Methods

void
add(mixed $index, TValue $value)

Add/insert a new value at the specified index

mixed
pop()

Pops a node from the end of the doubly linked list

mixed
shift()

Shifts a node from the beginning of the doubly linked list

void
push(TValue $value)

Pushes an element at the end of the doubly linked list

void
unshift(TValue $value)

Prepends the doubly linked list with an element

mixed
top()

Peeks at the node from the end of the doubly linked list

mixed
bottom()

Peeks at the node from the beginning of the doubly linked list

int
count()

Counts the number of elements in the doubly linked list.

bool
isEmpty()

Checks whether the doubly linked list is empty.

int
setIteratorMode(int $mode)

Sets the mode of iteration

int
getIteratorMode()

Returns the mode of iteration

bool
offsetExists(mixed $index)

Returns whether the requested $index exists

mixed
offsetGet(mixed $index)

Returns the value at the specified $index

void
offsetSet(mixed $index, TValue $value)

Sets the value at the specified $index to $newval

void
offsetUnset(mixed $index)

Unsets the value at the specified $index

void
rewind()

Rewind iterator back to the start

mixed
current()

Return current array entry

mixed
key()

Return current node index

void
next()

Move to next entry

void
prev()

Move to previous entry

bool
valid()

Check whether the doubly linked list contains more nodes

void
unserialize(string $data)

Unserializes the storage

string|null
serialize()

Serializes the storage

array
__debugInfo()

No description

array
__serialize()

No description

void
__unserialize(array $data)

No description

Details

void add(mixed $index, TValue $value)

Since: 5.5

Add/insert a new value at the specified index

Parameters

mixed $index

The index where the new value is to be inserted.

TValue $value

The new value for the index.

Return Value

void

mixed pop()

Pops a node from the end of the doubly linked list

Return Value

mixed

The value of the popped node.

mixed shift()

Shifts a node from the beginning of the doubly linked list

Return Value

mixed

The value of the shifted node.

void push(TValue $value)

Pushes an element at the end of the doubly linked list

Parameters

TValue $value

The value to push.

Return Value

void

void unshift(TValue $value)

Prepends the doubly linked list with an element

Parameters

TValue $value

The value to unshift.

Return Value

void

mixed top()

Peeks at the node from the end of the doubly linked list

Return Value

mixed

The value of the last node.

mixed bottom()

Peeks at the node from the beginning of the doubly linked list

Return Value

mixed

The value of the first node.

int count()

Counts the number of elements in the doubly linked list.

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

bool isEmpty()

Checks whether the doubly linked list is empty.

Return Value

bool

whether the doubly linked list is empty.

int setIteratorMode(int $mode)

Sets the mode of iteration

Parameters

int $mode

There are two orthogonal sets of modes that can be set:

The direction of the iteration (either one or the other): SplDoublyLinkedList::IT_MODE_LIFO (Stack style)

Return Value

int

int getIteratorMode()

Returns the mode of iteration

Return Value

int

the different modes and flags that affect the iteration.

bool offsetExists(mixed $index)

Returns whether the requested $index exists

Parameters

mixed $index

The index being checked.

Return Value

bool

true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

mixed offsetGet(mixed $index)

Returns the value at the specified $index

Parameters

mixed $index

The index with the value.

Return Value

mixed

Can return all value types.

void offsetSet(mixed $index, TValue $value)

Sets the value at the specified $index to $newval

Parameters

mixed $index

The index being set.

TValue $value

The value to set.

Return Value

void

void offsetUnset(mixed $index)

Unsets the value at the specified $index

Parameters

mixed $index

The index being unset.

Return Value

void

void rewind()

Rewind iterator back to the start

Return Value

void

Any returned value is ignored.

mixed current()

Return current array entry

Return Value

mixed

Can return any type.

mixed key()

Return current node index

Return Value

mixed

TKey on success, or null on failure.

void next()

Move to next entry

Return Value

void

Any returned value is ignored.

void prev()

Move to previous entry

Return Value

void

bool valid()

Check whether the doubly linked list contains more nodes

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

void unserialize(string $data)

Since: 5.4

Unserializes the storage

Parameters

string $data

The string representation of the object.

Return Value

void

string|null serialize()

Since: 5.4

Serializes the storage

Return Value

string|null

The string representation of the object or null

array __debugInfo()

Since: 7.4

No description

Return Value

array

array __serialize()

Since: 7.4

No description

Return Value

array

void __unserialize(array $data)

Since: 7.4

No description

Parameters

array $data

Return Value

void