returing nodeValues using while loop
<p>I am using xpath to get various elements on a page. If I use a foreach loop like this <code>foreach ($company as $node) { echo $node-&gt;nodeValue. "&lt;br&gt;"; }</code> it works but I am only able to return values from one variable so that means I have to create two separate foreach loops. I want to be able to use the while loop so I can return both values from variable at the same time. The while loop doesnt return any error or values.</p>

<pre><code>$doc = new DOMDocument();
@$doc-&gt;loadHTML($source);
$xpath = new DOMXpath($doc);

$company = $xpath-&gt;query("//*[@class='name']");
$address = $xpath-&gt;query("//*[@class='address']");

$i = 0;

while ($i &lt; count($company)) {
   echo $company-&gt;nodeValue. "&lt;br&gt;";
   echo $address-&gt;nodeValue. "&lt;br&gt;&lt;br&gt;";
   $i++;
}
</code></pre>
