Skip to content
Thomas Weinert edited this page Jul 12, 2018 · 2 revisions

FluentDOM\Nodes ArrayAccess

FluentDOM\Nodes implements the ArrayAccess interface. You can access the found nodes using array syntax.

Usage

$xml = <<<XML
<html>
<body>
  <p>Hello</p>
  <p>cruel</p>
  <p>World</p>
</body>
</html>
XML;

$document = FluentDOM($xml)->find('//p');
echo $document[0], ' ', $document[2];

Output

Hello World
Clone this wiki locally