时间:2021-07-01 10:21:17 帮助过:49人阅读
$arr1 = array('1','2','3','4','5','6','7','8','9');for($i=0;$i";}
$start = 1;$arr = array(1, 2, 3, 4, 5, 6, 7, 8, 9);$length = count($arr);for($stepX=0;$stepX<$length;$stepX++){ for($stepY=0;$stepY<$length;$stepY++){ echo $arr[($stepX+$stepY+$start)%$length].' '; } echo '
';}
如下,效果:
2 3 4 5 6 7 8 9 1
3 4 5 6 7 8 9 1 2
4 5 6 7 8 9 1 2 3
5 6 7 8 9 1 2 3 4
6 7 8 9 1 2 3 4 5
7 8 9 1 2 3 4 5 6
8 9 1 2 3 4 5 6 7
9 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
$arr1 = array('1','2','3','4','5','6','7','8','9');for($i=0;$i";}
=10){ $tmp = $tmp%10+1; } printf("%3d", $tmp); if(($i+1)%9==0){ echo '
'; }}?>
你这是什么?
九宫格是3x3矩阵(填写1-9个数)
数独是9个九宫格的组合