RE: [PHP] dynamic variable headache

From: Date: Fri, 08 Nov 2002 18:33:12 +0000
Subject: RE: [PHP] dynamic variable headache
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123447@lists.php.net to get a copy of this message
> My newbie brain is maxed out on this, and I'm sure one of you more > experience guys can quickly straighten me out. > > I've got a variable: > > $_yyyymmdd = a_date_value; > > Later, I've got four variables; > > $foo= _; > $bar=yyyy; > $bleh=mm; > $doh=dd; > > I want to stick these variables together on the fly to get "_yyyymmdd " > and use that value as a variable name to return "a_date_value". > > It would be the equivalent of, > > echo "$foo$bar$bleh$doh"; > > That would give me "a_date_value" > > I've read the docs on dynamic variables but still can't seem to break > through mentally on this one. Can you clear this up for me? $s = $foo . $bar . $bleh . $doh; echo $$s; //will give you a_date_value ---John Holmes...

« previous php.general (#123447) next »