Forum Moderators: coopster
global $arrProductData, $arrItemData;
foreach ($arrProductData as $index => $value) {
unset($arrProductData[$index]);
}
foreach ($arrItemData as $index => $value) {
unset($arrItemData[$index]);
}
reset($arrProductData);
reset($arrItemData);
I am trying to:
- loop through some XML files
- fill up the array with data from 1 file
- insert the data into a database
- reset the array (as above)
- pick up the next XML file
- fill the aray with data again, etc.
It seems that when I do the above, the array is not being destroyed, as the data is all being duplicated.
Is there a better way of destroying the arrays, so that they can be filled with new values?
To make it worse, it only unsets that particular key but doesn't destroy the array entirely so that if you do this:
$array[0] = 0;
$array[1] = 1;
unset them then do
isset($array[1])
it will still bring back true instead of false.
So, there must be a way of getting rid of the array completely?
unset($GLOBALS['$arrProductData']);
unset($GLOBALS['$arrItemData']);