kmaid Posted February 22, 2009 Share Posted February 22, 2009 Hi, How can you store a variable name inside another variable and then refer to it? EG <? $Var1 = "Var2"; $Var2 = "WantedInfomation"; echo $Var1; //Somehow outputs "WantedInfomation" ?> Quote Link to comment https://forums.phpfreaks.com/topic/146399-solved-using-a-variable-name-stored-in-a-string/ Share on other sites More sharing options...
.josh Posted February 22, 2009 Share Posted February 22, 2009 echo $$Var1; Quote Link to comment https://forums.phpfreaks.com/topic/146399-solved-using-a-variable-name-stored-in-a-string/#findComment-768645 Share on other sites More sharing options...
darkfreaks Posted February 22, 2009 Share Posted February 22, 2009 <?php $Var1 = "Var2"; $Var2 = "WantedInfomation"; $newstring = $Var1.$Var2; echo $newstring; //Somehow outputs "WantedInfomation" ?> Quote Link to comment https://forums.phpfreaks.com/topic/146399-solved-using-a-variable-name-stored-in-a-string/#findComment-768647 Share on other sites More sharing options...
kmaid Posted February 22, 2009 Author Share Posted February 22, 2009 lol Darkfreaks Thanks Crayon Violent ! Quote Link to comment https://forums.phpfreaks.com/topic/146399-solved-using-a-variable-name-stored-in-a-string/#findComment-768650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.