class DOMNodeList implements IteratorAggregate, Countable (View source)

The DOMNodeList class

Properties

int $length

Methods

TNode|null
item(int $index)

Retrieves a node specified by index

int
count()

Get number of nodes in the list

getIterator()

Retrieve an external iterator

Details

TNode|null item(int $index)

Retrieves a node specified by index

Parameters

int $index

Index of the node into the collection. The range of valid child node indices is 0 to length - 1 inclusive.

Return Value

TNode|null

The node at the indexth position in the DOMNodeList, or null if that is not a valid index.

int count()

Since: 7.2

Get number of nodes in the list

Gets the number of nodes in the list.

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

Traversable getIterator()

Since: 8.0

Retrieve an external iterator

Returns an external iterator for the node list.

Return Value

Traversable

An instance of an object implementing Iterator or Traversable