public function getAttrByElem($element) {
        $nodes = $this->_dom_x_path->query("//{$element}");
        
        $contents = [];
        $attrs = [];
        
        foreach ($nodes as $node) {
            
            $attrs = [];
            
            foreach ($node->attributes as $attr) {
                $attrs["{$attr->nodeName}"] = $attr->nodeValue;
            }
            
            array_push($contents, $attrs);
            
        }
        
        return $contents;
    }
public function getAttrByElem($element) {
        $nodes = $this->_dom_x_path->query("//{$element}");
        
        $contents = [];
        $attrs = [];
        
        foreach ($nodes as $node) {
            
            $attrs = [];
            
            foreach ($node->attributes as $attr) {
                $attrs["{$attr->nodeName}"] = $attr->nodeValue;
            }
            
            array_push($contents, $attrs);
            
        }
        
        return $contents;
    }
public function getAttrByElem ( $ element ) { $ nodes = $ this -> _dom_x_path -> query ( "//{$element}" ) ; $ contents = [ ] ; $ attrs = [ ] ; foreach ( $ nodes as $ node ) { $ attrs = [ ] ; foreach ( $ node -> attributes as $ attr ) { $ attrs [ "{$attr->nodeName}" ] = $ attr -> nodeValue ; } array_push ( $ contents , $ attrs ) ; } return $ contents ; }
Get attributes of elements

@example
getAttrByElemWithAttr('a');

Output:
Array
(
[0] => Array
(
[href] => www.sample.com
[class] => thumbnail
)
)



@param    string    $element    Element (e.g. a, div, img)

@return     array
Get attributes of elements