sciencebear Posted November 6, 2009 Share Posted November 6, 2009 I'm trying to write a loop, but I want it to do something different after every fifth instance. Like, I want it do something like this: echo $a1; echo $a2; echo $a3; echo $a4; echo $a5.$b; echo $a6; And so on.. any idea on how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/180548-solved-do-something-every-fifth-time/ Share on other sites More sharing options...
Zane Posted November 6, 2009 Share Posted November 6, 2009 while($x if(($x % 5) == 0) echo "The Fifth Time!"; else echo $x; } Quote Link to comment https://forums.phpfreaks.com/topic/180548-solved-do-something-every-fifth-time/#findComment-952523 Share on other sites More sharing options...
sciencebear Posted November 6, 2009 Author Share Posted November 6, 2009 Thank you very much! That works great. Quote Link to comment https://forums.phpfreaks.com/topic/180548-solved-do-something-every-fifth-time/#findComment-952527 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.