-1
while($row=mysql_fetch_assoc($query)) {
$id = $row['id'];
$col1 = $row['name1'];
$col2= $row['name2'];
$col3= $row['name3'];
${"$id"} = array("$col1","$col2","$col3");
${"$s".$i}[] = ${"$id"};
}
這只是我試圖完成的一個簡單示例,$i
在其他地方增加。我試圖在數組中內爆數組。所以下面我已經內爆了主陣列,但我如何內爆其他陣列?內爆多維陣列
for($i=0;$i<11;$i++) {
$array = ${"s" . $i};
$outcomes = implode("",$array); //implodes main array
}
如果你想回顯一些變量,只是回顯它。爲什麼內爆? –
我有它結構化的某種方式..我只發佈這個作爲一個例子,我的真實代碼是更長。我只需要知道如何回顯數組中數組的值。 – user892134
[PHP:Implode數據來自多維數組]的可能重複(http://stackoverflow.com/questions/16710800/php-implode-data-from-a-multi-dimensional-array) – 2013-11-23 05:25:47