【发布时间】:2011-03-15 12:16:45
【问题描述】:
我有一个有 42 个 nrs 的网格,我将使用 rand() 函数从网格中挑选出数字并标记它们
到目前为止,我想出了
<?php
$row="";
print ("<table border=\"1\">");
for ($i=0; $i<6; $i++)
{
print ("<tr>");
for ($j=0; $j<7; $j++)
{
$random = rand(1,42);
$row += "(string)$random";
$som = $som + 1;
print("<th>".$som);
}
("</tr>");
}
print ("</table>");
print ("$rij");
// here I'm just testing to see if I can get a list of random numbers
for ($i=0; $i<6; $i++){
$randomNr = rand(1,42);
echo "$randomNr<br/>";
}
?>
我想这个想法是将 rand 函数中的数字与表的索引相匹配。但我真的被困在这里让表格转换为一个arra,所以我可以将索引与随机数匹配。
【问题讨论】: