Re: For Loop
| From: | David Tulloh | Date: | Tue, 20 Jun 2006 22:32:40 +0000 |
| Subject: | Re: For Loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238437@lists.php.net to get a copy of this message | ||
Are you sure that you don't want an array? Arrays are normally much
better for this type of thing.
That said,
${"p{$i}name"} = 'foo';
David
Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to get my syntax correct?
>
> Can someone point me in the right direction?
>
> Thanks.
>
> Albert Padley
>