我正在尝试用多维数组进行计算。这是我的代码:
<?php
$items = array(
array('id' =>1,
'DESC' =>'Widget Corporation',
'Price' =>30.00),
array(
'id' =>2,
'DESC' =>'Website Corporation',
'Price' =>40.00,
),
array(
'id' =>3,
'DESC' =>'Content Management',
'Price' =>50.00,
),
array(
'id' =>4,
'DESC' =>'Registration System',
'more'=>'Please Buy it',
'Price' =>60.00
)
);
foreach($items as $item){
$total =$item['Price'] + $item['Price'];
echo $total;
}
我得到了这个结果: 6080100120 而不是 180