Such practices make debugging code and maintaining large applications insanely difficult. It's just a bad thing to do, and is considered a common scripting/interpreted language thing. Kind of like goto Take care, Sina -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Sent: Friday, August 08, 2008 6:03 AM To: programmingblind@xxxxxxxxxxxxx Subject: Re: PHP - How Practical Is This? Hi Sina, What did you mean by your last statement? Thanks. Jim ----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Thursday, August 07, 2008 11:20 PM Subject: RE: PHP - How Practical Is This? > Wow, I had totally forgot about this. > > So basically, imagine if you wanted to dynamically choose a variable ... > if, > let's say, the name of the variable, was itself a variable. > > Like this: > > $cat = 0; > $dog = 0; > $snake = 0; > > function incrementCountOfPets($pet) > { > $$pet++; > } > > > Now, if you passed the string "cat" into that function, the cat variable > would be incremented, but if you passed in the string "dog", the dog > variable would be incremented. > > If you didn't have this feature, you would be forced to using an if > statement or a switch/case statement block. > > It is truly mind boggling how many good design principles languages such > as > php can allow one to break, *smile*. > > Take care, > Sina > > -----Original Message----- > From: programmingblind-bounce@xxxxxxxxxxxxx > [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of > james.homme@xxxxxxxxxxxx > Sent: Tuesday, August 05, 2008 7:35 AM > To: programmingblind@xxxxxxxxxxxxx > Subject: PHP - How Practical Is This? > > > Hi, > I don't understand how this works, so I don't know how important or > practical it is. This is some text from a PHP book I'm reading. > > Variable Variables > > On occasion, you may want to use a variable whose content can be treated > dynamically > as a variable in itself. Consider this typical variable assignment: > $recipe = "spaghetti"; > Interestingly, you can treat the value spaghetti as a variable by placing > a > second > dollar sign in front of the original variable name and again assigning > another value: > $$recipe = "& meatballs"; > This in effect assigns & meatballs to a variable named spaghetti. > Therefore, the following two snippets of code produce the same result: > echo $recipe $spaghetti; > echo $recipe ${$recipe}; > The result of both is the string spaghetti & meatballs. > > Thanks. > > Jim > James D Homme, Usability Engineering, Highmark Inc., > james.homme@xxxxxxxxxxxx, 412-544-1810 > > "The difference between those who get what they wish for and those who > don't is action. Therefore, every action you take is a complete > success,regardless of the results." -- Jerrold Mundis > Highmark internal only: For usability and accessibility: > http://highwire.highmark.com/sites/iwov/hwt093/ > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind