vhaxu Posted June 12, 2010 Share Posted June 12, 2010 I need help combining variables. $foo = "bar"; $bar = "10"; How do I easily make $foo = 10? (I have to do this with about a hundred variables) Link to comment https://forums.phpfreaks.com/topic/204545-variable-help/ Share on other sites More sharing options...
kenrbnsn Posted June 12, 2010 Share Posted June 12, 2010 The simplest way is <?php $foo = 'bar'; $bar = 10; $foo = $bar; ?> Or you can use variable variables <?php $foo = 'bar'; $bar = 10; $foo = $$foo; echo $foo; ?> Ken Link to comment https://forums.phpfreaks.com/topic/204545-variable-help/#findComment-1071040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.