0

Ok, I have a multidimensional array that is populated dynamically via an API. Users can enter in arrays of information that are transformed into a multidimensional array, which would look something like this:

$object = array(
    array(
        'key1' => 'value 1',
        'key2' => 'value2'
    ),
    array(
        'key1' => 'value1',
        'key2' => 'value2'
    )
);

Next, I've been running a foreach loop to grab all the information I need, and everything works great. But here's the issue I'm running into - each array on information will output a block of info within a

tag. If 5 arrays are inputted, that's way too many blocks of information. Each array has many different if/else checks which is what is throwing me off. I can't simply break after the first foreach loop because I need to grab all the information from each array.

Basically what I am asking is how can I loop through an entire multidimensional array and only output one bit of information?

I hope what I am asking makes sense. If not, let me know and I will try to explain more. This is more of a conceptual question for me.

Thomas
  • 188
  • 3
  • 11
  • Go over it with foreach and then execute the function AFTER that? – Dvir Oct 16 '11 at 18:16
  • 2
    I don't really understand what you are asking. Could you give a more specific example and I can try to help? – Chris Oct 16 '11 at 18:17
  • Your array example is too abstract. Unknown if the array keys have significance. Otherwise just [flatten the array](http://stackoverflow.com/questions/1319903/how-to-flatten-a-multidimensional-array) beforehand, or simply `array_walk_recursive()`. -- If you need a more specific answer, post your current processing code in place of your vague explanation. – mario Oct 16 '11 at 18:40

0 Answers0