search

Home  >  Q&A  >  body text

Regarding homework, please help me, otherwise I will be thinking about this issue even while eating and sleeping.

<?php
echo '<table width="800" border="1">';
for ($i = 0; $i < 100; $i ) {
if($i ==0){
if($i ==0){
echo '<tr>';
}else{
echo '<tr bgcolor "red">';
I can't understand why $i needs to be incremented by 1. When trying to remove increment if($i ==0), the list will lose its original order, but this is not the case at the end of </tr> in the while loop. In the case of adding 1, the strange thing is that 1 was not added at the end of the while loop. After adding 1, the original order of the list is also lost.
if(($i 1) ==0){
echo '</tr>';

}

}
echo '</table>';
?>

HUNTHUNT2675 days ago1469

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-07-31 15:41:22

    Seeing all these Chinese characters in capital letters makes me a little dizzy. I want to know if you have solved this problem now

    reply
    0
  • 树&刀布

    树&刀布2017-07-29 12:09:38

    Because </tr> is to be output for the tenth time, $i is initially 0, (10)%10==0; and $I==9 for the tenth time; so $i+1)%10==0

    reply
    0
  • 树&刀布

    树&刀布2017-07-29 11:45:41

    Because <td> is adaptive by default and automatically adjusts according to the field length. 100 is a three-digit number indicating the length of the <tr>. The solution can be to give <tr> a width, or to pad the field with zeros or spaces. , make all fields the same length

    reply
    0
  • Cancelreply