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? 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; } 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. 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
Archived
This topic is now archived and is closed to further replies.