是否有可能将2个变量“粘合”为foreach中的变量?我已经尝试过使用dot_combine中的点。都给我错误...... $ courseFiles是一个数组,而$ block [id]是一个int。
<?php
foreach($courseFiles . $block["id"] as $courseFile): ?>
<tr>
<td><?php echo htmlentities($courseFile["Exercise Name"]) ?></td>
<td><?php echo htmlentities($courseFile["Logsheet"]) ?></td>
<td><?php echo htmlentities($courseFile["EBF Sheet"]) ?></td>
</tr>
<?php endforeach;
?>
答案 0 :(得分:0)
试试这个:
$myvar = array();
// assign values to $myvar array.
$myvar[$index] = $courseFiles[$index] . $block["id"];
foreach($myvar as $courseFile)
{ //some code }