serverman Posted May 18, 2008 Share Posted May 18, 2008 Ok how would get this to work (this is just a guess at the code) <?php $n = 5 echo "test " * $n ; ?> outcome of test test test test test sorry I am really new to this and wasn't sure were to find this out on W3schools or php.net Link to comment https://forums.phpfreaks.com/topic/106232-solved-echo-x-number-of-timesreally-noob-question/ Share on other sites More sharing options...
AndyB Posted May 18, 2008 Share Posted May 18, 2008 for() is the answer - http://ca.php.net/manual/en/control-structures.for.php Link to comment https://forums.phpfreaks.com/topic/106232-solved-echo-x-number-of-timesreally-noob-question/#findComment-544486 Share on other sites More sharing options...
serverman Posted May 18, 2008 Author Share Posted May 18, 2008 ok here is what i did and it works <?php $n = 2; for ($i = 1; $i <= $n; $i++) { echo "test"; } ?> oh and thank you Link to comment https://forums.phpfreaks.com/topic/106232-solved-echo-x-number-of-timesreally-noob-question/#findComment-544497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.