我有两个 cookie,它们的值如下:
foreach($_COOKIE as $key=>$val) {
$piece = explode(",", $val);
$t_cost = array($piece[3]);
print_r($t_cost); //It prints Array ( [0] => 11 ) Array ( [0] => 11 )
echo $total_cost = array_sum($t_cost);
}
但它只打印一个值。我该如何将两个值加起来并进行求和?