Variable Variables

I came across the interesting notion of $a and $$a, which in turns uses
the string in $a as a $-suffix to make a new dynamic variable.

Can someone illustrate a practical use out of it? I will be very curious
to see one (webdesign related) example of its usage.

Thanks,
Animesh
Animesh Kumar [ So, 06 April 2008 23:16 ] [ ID #1936642 ]

Re: Variable Variables

..oO(Animesh K)

>I came across the interesting notion of $a and $$a, which in turns uses
>the string in $a as a $-suffix to make a new dynamic variable.
>
>Can someone illustrate a practical use out of it? I will be very curious
>to see one (webdesign related) example of its usage.

There's hardly a reason to use them. Often enough they are misused in
situations where an array would be much more appropriate.

Micha
Michael Fesser [ So, 06 April 2008 23:52 ] [ ID #1936643 ]

Re: Variable Variables

Animesh K wrote:
> I came across the interesting notion of $a and $$a, which in turns uses
> the string in $a as a $-suffix to make a new dynamic variable.
>
> Can someone illustrate a practical use out of it? I will be very curious
> to see one (webdesign related) example of its usage.
>
> Thanks,
> Animesh
>

I agree with Micha. Variable variables are a solution looking for a
problem. It creates code which is very difficult to manage and update,
and should not be used.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex [at] attglobal.net
==================
Jerry Stuckle [ Mo, 07 April 2008 03:31 ] [ ID #1937277 ]

Re: Variable Variables

Jerry Stuckle wrote:
> Animesh K wrote:
>> I came across the interesting notion of $a and $$a, which in turns
>> uses the string in $a as a $-suffix to make a new dynamic variable.
>>
>> Can someone illustrate a practical use out of it? I will be very
>> curious to see one (webdesign related) example of its usage.
>>
>> Thanks,
>> Animesh
>>
>
> I agree with Micha. Variable variables are a solution looking for a
> problem. It creates code which is very difficult to manage and update,
> and should not be used.
>

Thanks for the reply. I will stop taxing my brain on the use of variable
variables :)

Best,
Animesh
Animesh Kumar [ Mo, 07 April 2008 21:40 ] [ ID #1940490 ]
PHP » comp.lang.php » Variable Variables

Vorheriges Thema: Re: PHP CLI: Sending parameters via command line
Nächstes Thema: Automatic Daily Personalized E-mails