Skip to content
Thomas Weinert edited this page Jul 30, 2014 · 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;

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

Output

Hello World
Clone this wiki locally