$arr = array("0" => array(
"from" => '2011-12-22 06:30',
"to" => '2011-12-22 09:00'
),
"1" => array(
"from" => '2011-12-22 10:30',
"to" => '2011-12-22 11:00'
),
"2" => array(
"from" => '2011-12-22 12:30',
"to" => '2011-12-22 13:00'
)
);
$datetime = new DateTime("06:00");
echo "<table>";
for($i=0; $i<20; $i++) {
echo "<tr>";
$datetime->modify('+30 minutes');
for ($j=0; $j<7; $j++){
if($arr[0]['from'] == $datetime->format('Y-m-d H:i') ) {
$class = ' class="red"';
} else {
$class = '';
};
echo "<td $class>" . $datetime->format('Y-m-d H:i') . "</td>";
$datetime->modify('+1 day');
}
echo "</tr>";
}
echo "</table>";
现在我只检查$ arr * [0] *。是否可以检查此阵列中的所有位置(当前0,1,2)?现在这只检查最后一个元素。我想检查数组中的所有数据。