Using foreach loops
Posted: Mon Jun 06, 2005 2:11 am
Just wondering about calling the foreach function.
Lets say I have an array with repeated values and I wanted to run a loop for each individual version. I could do something like ...
... but I'm wondering if there are going to be problems with something like ...
I guess what I'm really worried about is that it will run the array_unique on each pass.
Any help would be great. Cheers
Lets say I have an array with repeated values and I wanted to run a loop for each individual version. I could do something like ...
Code: Select all
$arr_ing = array_unique($ing_list);
foreach($ing_list as $key=>$item) {
// do something
}Code: Select all
foreach(array_unique($ing_list) as $key=>$item) {
// do something
}Any help would be great. Cheers