Re: alternating foreach elements
| From: | ruusvuu at whitney dot dns2go dot com | Date: | Sat, 19 Apr 2003 22:48:43 +0000 |
| Subject: | Re: alternating foreach elements | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144505@lists.php.net to get a copy of this message | ||
Quoting Jim Lucas <phplist@zonedzero.net>:
> are you wanting to have a two column table with images? side-by-side ??
>
> or just
>
> img img <BR><BR>
> img img <BR><BR>
> img img <BR><BR>
This is what I wanted and I got if figured out with:
> > $i = 0;
> > foreach($_GET as $in => $on){
> > $array = explode('_', $in);
> > $i++;
> > $num = $array[1];
> > if ($i%2 == 0){
> > print "<img src=/uploads/$mls/$num.jpg width=340 hspace=6>";}
> > else {print "<img src=/uploads/$mls/$num.jpg width=340
> hspace=6><br><br>";}
> > }
>
> are you wanting to end up with something like that?
>
> Jim
> ----- Original Message -----
> From: <ruusvuu@whitney.dns2go.com>
> To: <php-general@lists.php.net>
> Sent: Saturday, April 19, 2003 1:58 PM
> Subject: [PHP] alternating foreach elements
>
>
> > Hello Gang:
> >
> > Can you see what I am trying to do here?:
> >
> > $odd = true;
> > foreach($_GET as $in => $on){
> > $array = explode('_', $in);
> >
> > $num = $array[1];
> > if ($odd == 'true'){
> > print "<img src=/uploads/$mls/$num.jpg width=340 hspace=6>";}
> > else {print "<img src=/uploads/$mls/$num.jpg width=340
> hspace=6><br><br>";}
> > }
> >
> >
> > What I am trying to do is print a number of images to the flyer with
> pictures
> > side by side.
> >
> > Make Sense?
> >
> > Thanks
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>