hey there,
as part of my application, I build an array of arrays. So, what I have is this:

$mainArray = array();
$mainArray = $somearray;//as built with results from a query
$mainArray = $someOtherArray;//built same as above

//I want to iterate:

foreach($mainArray as $array)
   foreach($array as $dataArray)
      echo $dataArray['0'];

But that seems to not work for me. I tried print_r($dataArray); inside my second foreach loop, but that shows that $dataArray is not read as an array. Rather, print_r prints out ints.

Any idea what's going on?

Thanks in advance.

5 Years
Discussion Span
Last Post by bibiki

hey jstfsklh211,
I have it working right now. I do not know what I missed because I forgot what my code looked like when it was not working, but it is working now.

The above is only the general form of what I have now. So the above is correct, but what I had was not exactly what the above generalizes.

thank you though.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.