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

FluentDOM\Query::after()

FluentDOM\Query after(string|array|\DOMNode|\DOMNodeList|\Traversable|callable $content);

Insert content after each of the matched elements.

Usage

$xml = <<<XML
<html>
  <head>
    <title>Examples: FluentDOM\Query::after()</title>
  </head>
  <body>
    <p>I would like to say: </p>
  </body>
</html>
XML;

require_once('../vendor/autoload.php');
echo FluentDOM($xml)
  ->find('//p')
  ->after('<b>Hello</b>')
  ->after(' World');

Output

<?xml version="1.0"?>
<html>
  <head>
    <title>Examples: FluentDOM\Query::after()</title>
  </head>
  <body>
    <p>I would like to say: </p><b>Hello</b> World
  </body>
</html>
Clone this wiki locally