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. Quote Link to comment 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; ?> Quote Link to comment 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 Quote Link to comment 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.