Re: How to construct variable names ?!
| From: | Ignacio Vazquez-Abrams | Date: | Sat, 25 Nov 2000 22:53:43 +0000 |
| Subject: | Re: How to construct variable names ?! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27191@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];
};
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>