Rabbit has the right answer for using references to edit values and index to unset in a foreach loop (I would vote you up but this is my first post so I don't have 15 rep yet, sorry)
be sure to remember to use the reference if you pass it through to a function that needs to edit the value as well.
You would also need to pass the array as a reference if it's to remove the value from it.
I'd recommend making the function return boolean on whether to remove to prevent creating more references. e.g.
foreach ($array AS $key => &$value) {
//& reference only needed if execFunction must edit $value
if (execFunction(&$value)) {
unset($array[$key]);
} else {
$value['exec_failed']+=1;
}
}
unset($value);
also the $value reference will persist past the scope of the loop, thus the trailing unset.
A last thought, it sounded as if you wanted to loop through the array multiple times. Be sure to pay attention to how your loop stops executing.