我有存储在以下数组$ _SESSION多阵列使用
[Bookings] => Array
(
[date] => Array
(
[0] => 1/12/2013
[1] => 1/19/2013
[2] => 2/03/2013
)
[price] => Array
(
[0] => 100
[1] => 150
[2] => 120
)
)
不过,我想用一个foreach循环和array.I内的两个值进行计算不能似乎想了解如何使用foreach来适应多值,我已经得到了一个我在下面写到的我试图实现的foreach样本。任何人都指向了正确的方向。
foreach ($_SESSION['Bookings'] as $bookings)
{
myDate = $bookings[date];
myPrice = $bookings[price];
// Some other stuff here
}
并不$ myDate [0]给'1/12/2013'? – Tuim
'MultipleIterator'的替代解决方案:http://stackoverflow.com/a/14724544/664108 –