One particular use is to check even / odd:
for($i=0; $i<10; $i++)
{
if($i%2==0)
echo "even"
else
echo "odd"
}
This idea could be used to color rows (tr) of a table differently for better presentation.
Another use is to close TR dynamically in a complex code (lets say, change tr after every 4 tds). Like:
echo "<tr>";
for($i=0; $i<10; $i++)
{
if($i%4==0)
echo "</tr><tr>";
echo "<td>";
.
.
.
echo "</td>";
}
echo "</tr>";
solved % (examples in loop) [closed]