Php determine every 5th record in interation
<?php $x = 5; for($i=0; $i<10; $i++) { if($i % $x == 0) { echo 'yes'; } } |
Result: yes yes
Explanation: 5 % 5 has remainder 0 (fully divided), 10 % 5 has remainder 0 (fully divided)
<?php $x = 5; for($i=0; $i<10; $i++) { if($i % $x == 0) { echo 'yes'; } } |
Result: yes yes
Explanation: 5 % 5 has remainder 0 (fully divided), 10 % 5 has remainder 0 (fully divided)