我想合併所有陣列。這是我的代碼:將所有陣列合併到一個陣列
...
$j = array();
foreach($result as $document)
{
$d1 = $document->w;
$d2 = $w;
$length = sqrt(pow($d1-$d2, 2));
$i++;
echo "<tr><td>$i</td><td>$d1 - $d2</td><td>=</td><td>$length</td></tr>";
settype($length, "array");
print_r($length);
}...
但是這是我的結果(array_merge將無法正常工作):
Array ([0] => 38.9944) Array ([0] => 6.1042) Array ([0] => 18.7779) Array ([0] => 11.8349) Array ([0] => 3.2698) Array ([0] => 9.2999) Array ([0] => 7.7512) Array ([0] => 5.4868) Array ([0] => 31.1248) Array ([0] => 6.1896) Array ([0] => 9.2577) Array ([0] => 17.8437) Array ([0] => 10.7357) Array ([0] => 0.8981) Array ([0] => 8.7666) Array ([0] => 2.7877) Array ([0] => 27.7104) Array ([0] => 10.3047) Array ([0] => 19.0708) Array ([0] => 14.5354) Array ([0] => 17.03) Array ([0] => 3.4082) Array ([0] => 22.3757) Array ([0] => 9.7722) Array ([0] => 11.778) Array ([0] => 3.7674) Array ([0] => 15.5889) Array ([0] => 0.6329) Array ([0] => 24.1031) Array ([0] => 10.2158) Array ([0] => 1.5809) Array ([0] => 13.4723) Array ([0] => 4.8482) Array ([0] => 0.989) Array ([0] => 15.974) Array ([0] => 13.8557) Array ([0] => 2.7523) Array ([0] => 26.0451) Array ([0] => 9.049) Array ([0] => 2.6922) Array ([0] => 18.664) Array ([0] => 2.6961) Array ([0] => 0.8077) Array ([0] => 21.3762) Array ([0] => 29.8023) Array ([0] => 11.1632) Array ([0] => 19.1626) Array ([0] => 9.9158) Array ([0] => 5.108) Array ([0] => 12.8582) Array ([0] => 4.3698) Array ([0] => 24.3916) Array ([0] => 18.6804) Array ([0] => 1.9838) Array ([0] => 40.2745) Array ([0] => 10.9428) Array ([0] => 14.5778) Array ([0] => 8.443) Array ([0] => 2.2244) Array ([0] => 3.9861) Array ([0] => 4.2342) Array ([0] => 8.043) Array ([0] => 18.3285) Array ([0] => 13.3765) Array ([0] => 2.0827) Array ([0] => 7.2584) Array ([0] => 3.7701) Array ([0] => 23.3415) Array ([0] => 26.3657) Array ([0] => 25.3173)
我應該怎麼辦?你可以幫我嗎?謝謝。
array_merge的什麼輸出?以及你如何使用它? – Rishabh 2013-05-01 10:08:48