Re: dynamic variable headache
| From: | Bobby Patel | Date: | Fri, 08 Nov 2002 17:31:00 +0000 |
| Subject: | Re: dynamic variable headache | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123435@lists.php.net to get a copy of this message | ||
try this:
$yyyymmdd = "$foo.$bar.$bleh.$doh"; /*note double-quotes and the concat
operator (the period) */
$$yyyymmdd = a_date_value;
To test;
echo $yyyymmdd ;
echo $$yyyymmdd; /*provided that a_date_value is a string literal*/
Robert McPeak <RMCPEAK@jhuccp.org> wrote in message
news:sdcbab6c.044@ccp2.jhuccp.org...
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?
Thanks in advance.