Ryan Jameson (USA) wrote:
Hi Folks,

I've been using "variable variables" for years with PHP.

$var = "myVarName";
$$var = "Some Val";

echo $myVarName; //outputs "Some Val"


$varName = "myVarName";
$$varName = $var;

echo $$varName['second']; //should output "frank" but doesn't. :-\
echo $var['second']; //should output "frank" works fine.

Try adding
$frank = 'woopsie!';
to the top of your script and running it.
echo ${$VarName}['second'];
is what you want - you want to be very clear what order these things need to be analyzed in, especially when dealing with arrays and the likes.

- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to