3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $htmlDocument = new DOMDocument(); $htmlDocument->loadHTML('test'); $elements = $htmlDocument->getElementsByTagName('li'); $description = 'test'; if ($elements !== 0) { $description = "<ul>"; foreach ($elements as $value) { $description .= "<li>" . $value->nodeValue . "</li>"; } $description .= "</ul>"; } var_dump([ 'elements' => $elements, 'description' => $description, ]);
based on 5clkk
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.2.6
array(2) { ["elements"]=> object(DOMNodeList)#2 (1) { ["length"]=> int(0) } ["description"]=> string(9) "<ul></ul>" }