tags:

views:

22

answers:

1

Hello i got a question, i have a session array called 'addToCart', in there are multiple arrays with various id's, i would like to loop through these arrays with a foreach regardless of what the id name is. Does anyone know how i would approach this?

+3  A: 

Does the following construction satisfy your needs?

foreach ($addToChart as $key=>$value){
  // do anything you want with $key and $value
}

If you need to check "sub-arrays", you can check $value with is_array() function and add one more foreach loop inside.

Kel
this did the trick, tyvm
vincent