i have a foreach loop that goes through each element of an array and removes the element if needle isnt found in the value.
the problem is that the remove part doesnt seem to work, any ideas?
foreach ($temparr as $temparrval) {//loop through the array and remove the last entries until current page has been reached
if (strpos($temparrval,$dir[0]))
break;
else
array_shift($temparr);
}
does the foreach loop create a copy of the array when it loops through so you can not directly change it?
would i need to record the keys of the elements that are required to be removed and them remove them after the loop?