Jump to content

[SOLVED] for loop echo every 7 counts


FD_F

Recommended Posts

thanks for the idea but i dont know how often the loop runs it culd be even 150 times

 

 

 

Well my "for loop" works. All you have to do is just implement a calculation that correctly identifies

multiples of 7....

 

Then put the numerical answers into an array. And during the loop check the array values and if they

appear, then do an echo statement.

genericnumber1 beat me to it but is correct, made this test.

 

$i = 30;
$divNum = 7;

for ($d=0; $d<$i; $d++) {

// something happening
echo 'count = '.$d.'<br/>';
echo 'divNum = '.$d % $divNum;
echo '<br/>';

if ($d % $divNum == 0) {
	echo 'true<br/>';
}
echo '<hr>';
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.