Php - DOM Element

Table of Contents

About

DOM - Element in php.

Operations

  • get an attribute
$domElement->getAttribute("src");
  • Loop over attributes
if ($domElement->hasAttributes()) {
            foreach ($domElement->attributes as $attr) {
                $name = $attr->name;
                $value = $attr->value;
                $node[$name] = $value;
            }
}
$domElement->textContent;

Powered by ComboStrap