Then iterate over the collection of rows and checking if each elements nodeName (http://www.php.net/manual/en/class.domnode.php) property is equal to 'th'. If it is I would capture the nodeValue into an array. e.g. $attributes[$element->nodeValue].

Then to get it's value I would use the DOMNode::nextSibling property to get the next adjacent node which should be a td, so check its nodeName is equal to 'td' and then capture its nodeValue as the value of the previous node.

<?php
$doc = new DOMDocument();
$doc->loadHTMLFile("filename.html");
// OR
//$doc->loadHTML("<html><body>Test<br></body></html>");
$xpath = new DOMXpath( $doc );
$elements = $xpath->query("//tr");
$attributes = array();
//Loop over every row object
foreach( $elements as $row ){
//Look over each cell in each row
foreach( $row as $cell ){
//We only care about TH cells so we only look for those specifically
if( strtoupper($cell->nodeName) == 'TH' ){
//If we find a TH cell then check if we have an adjacent TD cell.
if( strtoupper($cell->nextSibling->nodeName == 'TD' ){
//Create an array item using the TH's value as the key and the TD's value as the value. e.g. $attributes['Beds'] = 7
$attributes[$cell->nodeValue] = $cell->nextSibling->nodeValue;
}
}
}
}

This is just an EXAMPLE and I make to guarantee this is efficient or even works. It is just to illustrate the concept I was trying to explain.

Read the documentation I linked too, looked at the example code, try to implement it in your use case and ask any additional questions you have, i'll do my best to help you.