You are here

public function Crawler::eq in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dom-crawler/Crawler.php \Symfony\Component\DomCrawler\Crawler::eq()

Returns a node given its position in the node list.

Parameters

int $position The position:

Return value

Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist.

2 calls to Crawler::eq()
Crawler::first in vendor/symfony/dom-crawler/Crawler.php
Returns the first node of the current selection.
Crawler::last in vendor/symfony/dom-crawler/Crawler.php
Returns the last node of the current selection.

File

vendor/symfony/dom-crawler/Crawler.php, line 326

Class

Crawler
Crawler eases navigation of a list of \DOMElement objects.

Namespace

Symfony\Component\DomCrawler

Code

public function eq($position) {
  foreach ($this as $i => $node) {
    if ($i == $position) {
      return $this
        ->createSubCrawler($node);
    }
  }
  return $this
    ->createSubCrawler(null);
}