我在PHP新手...有4個數組,我想顯示,但它不顯示任何內容....foreach中的多個賦值數組?
請與代碼
$new_strip_from_name[] = $strip_from_name;
$new_from_name[] = $from_name;
$new_to_name[] = $to_name;
$new_lastdata[] = $lastdata;
echo "<table style='border: 2px solid black; text-align:left'>";
foreach($new_from_name as $from_name2){
foreach($new_lastdata as $lastdata2){
foreach($new_to_name as $to_name2){
foreach($new_strip_from_name as $key => $value){
if((strpos($lastdata2, $value) !==FALSE)){
echo "<tr>";
echo "<td>$from_name2</td>";
echo "<td>$to_name2</td>";
echo "<td>$lastdata2</td>";
echo "</tr>";
}
}
}
}
}
echo "</table>";
樣品陣列指
$new_strip_from_name = array("okay");
$from_name; = array("john", "mar", "jeff");
$to_name; = array("phil", "india", "japan");
$lastdata; = array("[email protected]", "[email protected]", "[email protected]");
期望的輸出
什麼是你想要的輸出,請舉例。輸入數組也是例子。因爲我不認爲像這樣嵌套foreach循環會生成你想要的東西。 – RiggsFolly
顯示您的HTML文本輸入代碼。 –
做foreach {} foreach而不是foreach {foreach {}}。這在這裏沒有意義! –