Each 3rd Increment Loop PHP -


hi im looking way breakout of loop every 3 increments echo static string.this script echos "test" after each increment. want test after each 3rd increment. ideas ?

my loop:

<?php  $i = 0;  while (++$i < 100){ $x = $i - 3; if ($i+3) {echo $i . "<br>test<br>";} else{   echo $i . "<br>";}    } ?> 

try below code

<?php    for($i=1;$i<=100;$i++)    {        if($i%3==0)        {            echo $i."test"."<br>";        }    } ?> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -