For Loop Table in PHP

前端 未结 5 916
终归单人心
终归单人心 2021-01-04 08:02

I am trying to generate a table with php for loop, that lists numbers. Something like this:

1 | 2 | 3 | 4 | 5
2 | 3 | 4 | 5 | 1
3 | 4 | 5 | 1 | 2
4 | 5 | 1 |         


        
5条回答
  •  被撕碎了的回忆
    2021-01-04 08:29

    echo "
    "; for ( $i = 0; $i < 5; $i++ ) { echo ""; for ( $j = 0; $j < 5; $j++ ) { echo ""; } echo ""; } echo "
    ", ($j+$i)%5+1, "
    ";

提交回复
热议问题