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" ?> 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; 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" ?> 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 ! 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
Archived
This topic is now archived and is closed to further replies.