[thelist] iterating over two-dimensional arrays

Ashley Graham ph33rful at optonline.net
Mon Jul 5 17:29:56 CDT 2004


> I can't seem to get the
> 
>> echo <select name="$foo[$key];
> 
> 
> to echo anything--I've modified it so that it runs, adding the needed 
> quotation marks and everything. I don't get any errors, it simple echoes 
> nothing.
> 
> Any suggestions?

Actually, none needed, after a little goolgle-ing, I discovered an answer:

foreach ($styles as $key => $value) {
    echo "$key:";
    foreach ($value as $option) {
        echo "$option";
        }
    }

I couldn't of figured it out without your help though.

Thank you.



More information about the thelist mailing list