- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28
- Parse error: syntax error, unexpected '=' in /in/d6jZK on line 5
Process exited with code 255.
<div div="first-slide"></div>
<div div="container"></div>
<?php
htmlString = '<html>...</html>';//either generated, or loaded from a file
$dom = new DOMDocument;
$dom->loadHTML($htmlString);//or loadHTMLFile
$divs = $dom->getElementsByTagName('div');
foreach($divs as $div)
{
if ($div->hasAttribute('class') && strstr($div->getAttribute('class'), 'first-slide'))
{
//$div ~= <div class='one-two-three'>
$div->appendChild( echo '<div class="wrapper"></div>';);//check the docs to see what you can do
}
} ?>