for($j=1;$j<=3;$j++)
{
$rand0=rand(1,$num*2+$j);
$temp=$genes[$i][$rand0];
$genes[$i][$rand0]=0;
for($k=$rand0+1;$k<=$num*2+$j;$k++)
{
$temp1=$genes[$i][$k];
$genes[$i][$k]=$temp;
$temp=$temp1;
}
}
$num=4
小弟要在陣列中隨機插入3個0
插入0後其他數值往後移一格
echo出來陣列中的值都對
只是上面會顯示一堆
Notice: Undefined offset: 9 in C:\xampp\htdocs\thesis\algorithm.php on line
147
Notice: Undefined offset: 10 in C:\xampp\htdocs\thesis\algorithm.php on line
147
Notice: Undefined offset: 11 in C:\xampp\htdocs\thesis\algorithm.php on line
147
請問各位這要怎麼解決阿QQ