tqla Posted September 15, 2008 Share Posted September 15, 2008 Hello. I have an array that when I use this "foreach" I get: Larry David Joe Susan foreach($Custom5 as $key => $value) { $info = $value . " "; } How do I assign the resulting echo (Larry David Joe Susan) to a variable? so that I can call it with "$info". Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/124398-solved-foreach-result-to-a-variable/ Share on other sites More sharing options...
kenrbnsn Posted September 15, 2008 Share Posted September 15, 2008 You can do this (no foreach needed): <?php $info = implode(' ',$Custom5); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/124398-solved-foreach-result-to-a-variable/#findComment-642411 Share on other sites More sharing options...
tqla Posted September 15, 2008 Author Share Posted September 15, 2008 Thank you kenrbnsn!!!! That worked perfectly. You fricken saved me!!! I am definitely going to read all about implode tonight. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/124398-solved-foreach-result-to-a-variable/#findComment-642412 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.