Re: For loop question?
On May 8, 5:21 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 08 May 2008 23:14:44 +0200, Iván Sánchez Ortega
>
>
>
> <ivansanchez-...@rroba-escomposlinux.-.punto.-.org> wrote:
> > Rik Wasmus wrote:
>
> >> The correct way to do this is:
>
> >> $cats = array(
> >> 1 => array('moonlight.jpg' .......),
> >> 2 => array(....),
> >> 3 => array(....));
>
> > An alternate way to do the same is:
>
> > $cats[1] = array('moonlight.jpg' .......);
> > $cats[2] = array('foobar' .......);
> > $cats[3] = array(...);
>
> >> And then just use:
>
> >> foreach($cats[$_GET['cat'] as $img) echo $img;
>
> > You're missing a "]" here, Rik!
>
> Oh no! Now all I say is suspect, and therefor should not be followed.
> Forget what I said, having $cat_1 & $cat_2 like variable names must be a
> great idea :).
> --
> Rik Wasmus
Thanks Rik. Try it and it work perfectly! And i didn't need to read
the PHP Manual. I guess that's what a forum is for.
Thanks again for beeing 'in the mood'
Marco
|