Re: do while ?
| From: | Max Derkachev | Date: | Thu, 23 Nov 2000 14:58:22 +0000 |
| Subject: | Re: do while ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26833@lists.php.net to get a copy of this message | ||
"Mike P." wrote:
> I cant figure this out at all.Why doesnt this ever end?
> $i=1;
> do
> {
> echo $R1P;}
> while($i <16);
> $i++;
because $i++ is not within do { ... } while (....) loop
> Also...how do use a variable in a variable.I want to be able to print the
> contents of $R1P,R2P,R3P.....with a do loop.
the code you want:
$i =1;
do {
$var = "R".$i."P";
echo $$var;
$i++;
} while ($i < 16) ;
--
Best regards,
Max A. Derkachev mailto:kot@books.ru
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia