Re: Variables within variable names

From: Date: Thu, 02 May 2002 18:47:01 +0000
Subject: Re: Variables within variable names
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-95731@lists.php.net to get a copy of this message
On Friday 03 May 2002 02:43, Jackson Miller wrote: > I want to do something along the lines of: > > $type = "basic"; > $$type_user = "jaxn"; > echo $basic_user; > > and have the output be "jaxn". > > I have tried everything I can think of, and I have looked in all my > books. > > I know how to: > > $type = "basic"; > $$type = "jaxn"; > echo $basic; > > but this won't do what I need. I need the name of the variable to be a > variable plus some. > > I can probably reach my goals using arrays, but I just thought I would > ask first. Rather than tying yourself in knots, plus the fact that code using variable variables are mostly harder to debug, you are strongly advised to use arrays. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Your love life will be... interesting. */

« previous php.general (#95731) next »