I have this code:
foreach($categories as $category) {
$items = getItems($category);
foreach($items as $item) {
// some code to manipulate $item
}
}
As you can see, inner loop depends on outer loop. Problem is that if data is too big, this takes quite some time. Is there some way, algorithm or technique so that I can avoid inner loop that is dependent on outer loop ?
PS. I am using PHP 5.3 so yield is out of question. Also someone told me that may be recursion can be helpful here but I don't exactly know how to go about with that.
Thanks for the help
getItems's code