Re: How to construct variable names ?!
| From: | Juergen Hall | Date: | Sun, 26 Nov 2000 09:54:49 +0000 |
| Subject: | Re: How to construct variable names ?! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27249@lists.php.net to get a copy of this message | ||
> On Sat, 25 Nov 2000, Juergen Hall wrote:
>
> > I have a string array like
> > $fuse
> > and get its values by
> > $fuse[0], $fuse[1], ... and so on
> >
> > how do i generate corresponding
> > variables like
> > $fuse1, $fuse2, ...and so on
> >
> > ???
> > jyrgen
> >
>
> I've seen all sorts of creative responses to this question (parse_str(),
> eval(), etc.), but I think you're looking for something like the following:
>
> for ($i=0; $i<count($fuse); ++$i)
> {
> ${"fuse".$i}=$fuse[$i];
> };
>
exactly, but i was not sure about the
expression $("$fuse" $i)...If it will be
understood the way we want.
I guess it will only work with eval()
jyrgen