DomQuery::getAttr();
Attempts to retrieve the attribute matching the value of $key from all matched element of the previous XPath expression. This method will return either an array containing values of the matched attributes or a list of DOMAttr instances.
$DomQuery = new DomQuery;
foreach($DomQuery->load($xml)->path('//foo')->getAttr('id') as $key => $value)
{
echo "{$key} = {$value}<br />";
}
Definition:
public function getAttr($key, $return_node = false)
Parameters:
| Name | Type | Description |
|---|---|---|
| $key | String | The name of the attribute. |
| $return_node | Boolean | Returns either a list of node values or instances of DOMAttr. |