关联数组循环相同的值

I have an associative array where i put DomElements. I want just recovers a cell from a table so i loop the rows($materie) and i try to extract for each the 9 column cell. The problem is that the result of the $cell[$o][9]->nodeValue ( that i put on $DTO['materie'][$o]['prenotato']) is the same for each turn of the loop: it take the value of the first element and keep the same.

   for($o = 0; $o < sizeof($materie); $o++) {

        $DTO['materie'][$o] = $materie[$o+1];
        /**ROWS */

        $cell = array();
        $cell[$o] = $parserCommons->findElementsByTag($table[0], 'td');

        $DTO['materie'][$o]['prenotato'] = $cell[$o][9]->nodeValue; 

    }


    return $DTO;

this is the function body:

public function findElementsByTag($DOMArray, $tagName)
{
    $output = $DOMArray->getElementsByTagname($tagName);
    return $output;
}

The problem is the call ...

$cell[$o] = $parserCommons->findElementsByTag($table[0], 'td');

So it is always using $parserCommons as the start point to find the <td> tags. So this will always find the same set of fields.

If your rows are in $materie, then I think you need

$cell[$o] = $materie[$o+1]->findElementsByTag($table[0], 'td');

so that it uses the current row for the start point.