Have a very large xml data feed I am parsing in PHP so Im using xmlReader because simpleXML fails everytime - just locks up and stops. Even with an xmlReader/simpleXML hybrid code, it still fails so Im doing it all in xmlReader - unfortunately.
So, Im confused on where to open and close xmlReader in relation to my loops. I need the best memory managment possible.
****Open reader Here????
Foreach ($modelArray as $model)// there are 10000 models
****OR open reader Here???
if(!$reader->open($request_url)){
echo "Error";
break;
}
while ($reader->readToNext('Product'){ // There are 500 Products per model
//do my node processing here. Grab nodes and add to mysql DB
}
return array('msg' => $msg,'addedProdsPerManu' =>$counter_addedProdsManu);
****Close Reader HERE?
}//close foreach
****OR Close Reader HERE?
Any advice would be greatly appreciated for the most efficient memory utilization so this program will run all the way through.
Thank you