canabatz Posted December 17, 2009 Share Posted December 17, 2009 hi , how do i put this code in 1 value: <?php for ($i=1; $i<=5; $i++) { echo $i ; } ?> the output will be: 12345 how do i put the result in one value ,some thing like : if the result is 12345 then it will be equal to $the_value and when i echo $the_value , the result will be 12345 the quastion is how to put the result of the forloop in one value for later use thanx Link to comment https://forums.phpfreaks.com/topic/185443-puting-for-loop-in-1-value/ Share on other sites More sharing options...
teamatomic Posted December 17, 2009 Share Posted December 17, 2009 <?php for ($i=1; $i<=5; $i++) { $x.="$i"; echo "$i<br>"; } echo "$x"; ?> HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/185443-puting-for-loop-in-1-value/#findComment-979032 Share on other sites More sharing options...
canabatz Posted December 17, 2009 Author Share Posted December 17, 2009 thanx man this is what i needed .= ? Link to comment https://forums.phpfreaks.com/topic/185443-puting-for-loop-in-1-value/#findComment-979035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.