stevehossy Posted March 19, 2009 Share Posted March 19, 2009 WHat i want is to have something like user print is 3 so like print echo 3 times, repeat it as many times as the user has set. if user has 2, echo 'Hi'; shows up 2x, if user has 3 then it shows up 3x, long story why i need it but is it possible? Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/ Share on other sites More sharing options...
jackpf Posted March 19, 2009 Share Posted March 19, 2009 Something like this...? <?php $limit = $_POST['limit']; //Idk how you get this, but put it here for($i = 0; $i <= $limit; $i++) { echo 'Hi'; } ?> Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/#findComment-788764 Share on other sites More sharing options...
stevehossy Posted March 19, 2009 Author Share Posted March 19, 2009 so simple. Thanks thats exactly what i needed. Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/#findComment-788767 Share on other sites More sharing options...
jackpf Posted March 19, 2009 Share Posted March 19, 2009 No problem. Gotta love the for() loop Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/#findComment-788770 Share on other sites More sharing options...
trq Posted March 19, 2009 Share Posted March 19, 2009 No problem. Gotta love the for() loop Not as much as string functions. See str_repeat. Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/#findComment-788846 Share on other sites More sharing options...
jackpf Posted March 19, 2009 Share Posted March 19, 2009 Wow...I didn't even know that existed. Lol. What an apt function for this situation... Link to comment https://forums.phpfreaks.com/topic/150191-repeat-echo/#findComment-788852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.