$big_box = array(1,2,3,16,17,18,31,32,33,46,47,48,61,62,63,76,77,78,91,92,93,106,107,108,121,122,123,136,137,138............);
$small_box = array(4,19,34,49,64.............);
我要生成動態數字數組像上面的例子中高達10000如何生成動態數字數組像下面
$big_box = array(1,2,3,16,17,18,31,32,33,46,47,48,61,62,63,76,77,78,91,92,93,106,107,108,121,122,123,136,137,138............);
$small_box = array(4,19,34,49,64.............);
我要生成動態數字數組像上面的例子中高達10000如何生成動態數字數組像下面
數組$big_box
嘗試這樣的事情。
$j = 0;
for ($i=0; $i <= 1000; $i++) {
if ($i!=0) {
$big_box[] = $i;
$j++;
}
if ($j == 3) {
$j = 1;
$big_box[] = $i+13;
$i =$i+13;
}
}
echo "<pre>";
print_r($big_box);
和數組$small_box
$small_box = array();
for($i=0; $i <= 1000; $i++) {
if ($i == 0) {
$small_box[$i] = 4;
}else{
$small_box[$i] = $small_box[$i-1]+15;
}
}
echo "<pre>";
print_r($small_box);
你可以請$ small_box幫忙嗎? –
我上傳了兩個。請檢查 –
感謝mota bhai :) –
而且數字是隨機的?或者有訂單嗎? – Jerodev
不,它會按照與示例相同的順序。 –