Turning a variable value into another variable name?
What I'm trying to figure out is if I can send a variable value into a function and then execute the value as a variable (but I need to add some text to the end of the value). Its hard to explain, so I'll try to show it the best I can in code:
Where the variable
I read the previous entry in this community and that got me thinking of adding an additional $ to the variable name, but that still didn't work. Checked the PHP manual, googled, etc but no luck.
Any suggestions?
function print_profile($who) {
echo $who."_long";
}
print_profile("bob");Where the variable
$bob_long is an actual variable that I want to echo. The most I can get it to do right now is actually echo "bob_long". I tried using the eval() function because I know you can do kind of what I'm asking in Javascript with Javascript's eval() function, but alas... wouldn't work.I read the previous entry in this community and that got me thinking of adding an additional $ to the variable name, but that still didn't work. Checked the PHP manual, googled, etc but no luck.
Any suggestions?
