Skip to content
Thomas Weinert edited this page Jul 30, 2014 · 1 revision

FluentDOM\Nodes::toArray()

array toArray();

Returns the found nodes as an array.

Usage

$xml = <<<XML
<html>
  <head>
    <title>Examples: FluentDOM\Nodes::toArray()</title>
  </head>
<body>
  <p>Hello</p>
  <p>cruel</p>
  <p>World</p>
</body>
</html>
XML;

$nodes = FluentDOM($xml)->find('//p')->toArray();
array_splice($nodes, 1, 1);
echo implode(' ', $nodes);

Output

Hello World
Clone this wiki locally