How can I take all the attribute of an element? Like on my example below I can only get one at a time, I want to pull out all of the anchor tag\'s attribute.
$html = $data['html']; if(!empty($html)){ $doc = new DOMDocument(); $doc->loadHTML($html); $doc->saveHTML(); $datadom = $doc->getElementsByTagName("input"); foreach($datadom as $element) { $class =$class." ".$element->getAttribute('class'); } }