Re: [PHP3] Constructing Variables from Variables?
| From: | (Richard Lynch) | Date: | Fri, 09 Jun 2000 22:59:11 +0000 |
| Subject: | Re: [PHP3] Constructing Variables from Variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1488@lists.php.net to get a copy of this message | ||
In article <B562EDCB.140E7%clarencek@ifurnishing.com>,
clarencek@ifurnishing.com (Clarence Kwei) wrote:
> I'm having a really tough time figuring this out... I basically need to
> generate the following variables:
>
> $ref_url_1
> $ref_url_2
> $ref_url_3
> $ref_url_4
> $ref_url_5
>
> However, the numbers at the end of "$ref_url_#" are generated from another
> variable: $url_counter that's cycling in a while loop that's creating input
> boxes... the code:
>
> name="ref_url_<? echo "$url_counter"; ?>"
echo $$ref_url_1;
for ($i = 1; $i <=5; $i++){
echo "ref_url_$i";
echo ${"ref_url_$i"};
echo ${${"ref_url_$i"}};
}
> I've read a bunch of stuff about Variable Variables, but to quote the wrox
> book, "variable variables generally create more confusion than
> convenience... they are of little real benefit." Thanks. :-/
It *would* be easier to use an array...
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)