Re: while loop on an array
| From: | Mike Frazer | Date: | Thu, 24 Jan 2002 09:17:35 +0000 |
| Subject: | Re: while loop on an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81960@lists.php.net to get a copy of this message | ||
There's a rather easy way to process arrays with while loops (I saw it used
loosely in some of the other replies).
while ($i < sizeof($array)) {
... actions ...
$i++;
}
Hopefully you can tailor that to suit your needs.
Mike Frazer
"Joe Rice" <jrice@bigidea.com> wrote in message
news:20020123091728.A6274@bigidea.com...
>
> Hello,
>
> I would like to know how i can know when i'm at the
> end of an array during a while loop?
>
> reset($new_answers);
> while (list($new_qID,$new_aID) = each ($new_answers)) {
> $sql .= "qID=\"$new_qID\ ||" ";
> }
> $sql .= ") AND uID = \"$uID\"";
>
> i would like to know how to stop putting the " || " at
> the end of $sql in the middle of the while loop.
>
> any help would be appreciated.
>
> thanks,
> joe
>
>