search

Home  >  Q&A  >  body text

Looking for the answer to the double loop operation of for, the effect is like this

微信截图_20180504173334.png

beautiful.tomrrowbeautiful.tomrrow2399 days ago1473

reply all(2)I'll reply

  • 攀多多

    攀多多2018-07-16 18:56:50

    <?php

    //The following is a double-layer for, you should be able to understand it

    echo '<table width="800" border="1">' ;

    $m=0;

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

    for($y=0;$y< ;10;$y++){

    echo '<td>'.$m.'</td>';

    $m++;

    }

    if($i%2==0){

    echo '<tr bgcolor="red">';

    }

    else echo '</tr>'; }

    echo "</table>";

    ?>


    ##

    reply
    0
  • 恋上设计

    恋上设计2018-05-06 17:39:02

    <?php
    //循环
    for($i='0';$i<'10';$i++){
    	for($j='0';$j<'10';$j++){
    		echo $j+'10'*$i;
    	}
    	echo '<br/>';
    }

    reply
    0
  • beautiful.tomrrow

    Thanks, Daniel

    beautiful.tomrrow · 2018-05-06 18:19:14
  • Cancelreply