PDA

View Full Version : Need some help working with an array...


JJR512
03-17-2002, 09:11 AM
I've got some code that generates a nested array...an array inside an array, I guess.

The array is like this:

$article = array('0' => array('headline' => 'blah', 'text' => 'blah blah blah'), '1' => array('headline' => 'la', 'text' => 'la la la la'))

...and so on.

I don't know how to work with nested arrays like this. What I want to do is step through $article, for each nested array like '0' and '1', I want to put each value in the array, like the values for headline and text, into another variable like $headline and $text. Then those variables ($headline and $text) will be dumped into a "bits"-type template. I just don't know how to write the looping code so that for each first-level array (the '0' and '1' and so on), each item in the nested array (the 'headline' and 'text' and so on) get put into variables. Can someone please show me how to do that? Thanks!

JJR512
03-17-2002, 05:18 PM
Nevermind, I figured it out...

...hehe, you guys are going to LOVE this hack I'm working on! :)

But don't ask for details... ;)