- var_dump: documentation ( source)
<?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,
]);