justinh Posted February 3, 2009 Share Posted February 3, 2009 How would you add a variable to the name of a variable? This is probably the easiest thing to do in PHP, but it's late and can't figure it out =/ heres an example <?php $value = 1; $hello.$value = "hi"; echo $hello1; ?> Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/143586-variable-question/ Share on other sites More sharing options...
trq Posted February 3, 2009 Share Posted February 3, 2009 <?php $value = 1; ${'hello'.$value} = "hi"; echo $hello1; ?> Link to comment https://forums.phpfreaks.com/topic/143586-variable-question/#findComment-753397 Share on other sites More sharing options...
Snart Posted February 3, 2009 Share Posted February 3, 2009 $value = 1; $name = 'Hello'; $total = $value.$name; $Hello1 = 'world'; echo $$total; //Shows "world" on the screen Link to comment https://forums.phpfreaks.com/topic/143586-variable-question/#findComment-753398 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.