It seems to me that the use of a temp variable may be the clearest 
solution, and I doubt any overhead would matter really.

$a = "dog";
$tmp = "MY".$a; //$tmp = "MYdog";

So the following two would be the same:
$$tmp = "Spot";
$MYdog = "Spot";

Good Luck,

Jason Garber
IonZoft.com

At 09:47 PM 11/16/2001 -0500, Jeff Lewis wrote:
>I've a question regarding variable variable I was hoping someone could 
>help me with:
>
>All the examples in the manual have the entire variable name being 
>variable e.g.
>$a = "hello"   and
>$$a being the same as $hello
>
>What I need to do, however, is append a variable portion to a constant 
>prefix.  So I have a set of variables that are named $MYdog, $MYcat etc. 
>and I need to do
>
>$a = "dog"
>${"MY$a"} being the same as $MYdog
>
>Can this be done, and if so - how? I can't get it to work.
>
>Jeff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to