ballhogjoni Posted December 31, 2008 Share Posted December 31, 2008 lets say I have 1000 records to go thru. for every 100 records tell php to do something Link to comment https://forums.phpfreaks.com/topic/139042-solved-how-would-i-write-this-in-php/ Share on other sites More sharing options...
premiso Posted December 31, 2008 Share Posted December 31, 2008 <?php for ($i=1; $i<1001; $i++) { if (($i % 100) == 0) { echo 'Do This!'; }else { echo 'Not 100 so do this!'; } } ?> Modulus operator (%) will allow for this. Link to comment https://forums.phpfreaks.com/topic/139042-solved-how-would-i-write-this-in-php/#findComment-727220 Share on other sites More sharing options...
.josh Posted December 31, 2008 Share Posted December 31, 2008 Thread closed. You already have a thread about this. Please do not post multiple topics asking the same thing. Link to comment https://forums.phpfreaks.com/topic/139042-solved-how-would-i-write-this-in-php/#findComment-727229 Share on other sites More sharing options...
Recommended Posts