我上下搜索,但似乎无法让这个数组正常运行,我错过了一些简单但无法弄清楚到底是什么。
<?php
$dates2 = 'Aug 30, 2013';
$dates3 = 'Sep 13, 2013';
$cards[0] = array(
'card' => 'Discover',
'pay' => '875',
'when' => array('
'Sep 03, 2013',
'Oct 03, 2013',
'Nov 03, 2013',
'Dec 03, 2013'
),
);
$cards[1] = array(
'card' => 'Visa',
'pay' => '375',
'when' => array(
'Sep 23, 2013',
'Oct 23, 2013',
'Nov 23, 2013',
'Dec 23, 2013'
),
);
$cards[2] = array(
'card' => 'Mastercard',
'pay' => '1025',
'when' => array(
'Sep 12, 2013',
'Oct 13, 2013',
'Nov 13, 2013',
'Dec 13, 2013'
),
);
$cards[3] = array(
'card' => 'Amex',
'pay' => '650',
'when' => array(
'Aug 25, 2013',
'Sep 05, 2013',
'Oct 25, 2013',
'Nov 25, 2013'
),
);
for ($i=0; $i<=3; $i++){
if ($cards[$i]['when'][$i] > $dates2 && ($cards[$i]['when'][$i] < $dates3) or ($cards[$i]['when'][$i] == $dates2)) {
print "<tr>
<td>$cards[$i]['card']</td>
<td><input class='amount' size='3' value='$cards[$i]['pay']'></td>
</tr>";
}
}
?>
输出: Array['card'] Array['card'] Array['card'] Array['card']