I've been using simplexml_load_file to parse xml file with 15,000 records, it was working ok, but then when I tried to work with many files each of them is 15,000 it gave me this errorPHP
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 64 bytes)
Not sure what to do, The following is sample of what I'm doing,
$xml = simplexml_load_file($file)
or die("Error: Cannot create object");
foreach($xml->children() as $events){
foreach($events->load as $load){
$record = $load->loadrecord['record']." ";
if ($load->loadrecord['record'] == "test"){
foreach($events->receiveds as $received){
$release = $received->received['release'];
}
foreach($events->sender as $sender){
$test1 = $sender['test1'];
$test2 = $sender['test2'];
$test3 = $sender['test3'];
$test4 = $sender['test4'];
}
foreach($events->screens as $filter){
$record = $filter->filter['record'];
}
}
}
Do I need to free something after the parsing is completed, please note that the issue happens when have many files, I tried with two files and there was no problem
unset()on the variables once you're done with them to remove them from memory.ini_set('memory_limit', '256M');