I have a large function that is based on a seven tier multidimensional array?
When I call the function in a for each like so
foreach($items as $item) {
makeItem($item, $items[$item]);
}
It always fails why is this, although if I call them outside a foreach it is fine and works?
OK, now that you’ve changed the code a bit… The problem is that when you use a foreach loop as you did, the loop variable isn’t the index of the array, it’s the element in the array. Your intent is still unclear to me, but you might want to do something like:
…which still wouldn’t make sense because you would be passing in
$itemtwice.