請幫助完成此功能我想在這裏計算$ answer的總價值。foreach的總值
<?php
foreach($_POST as $fieldName=> $answer){
if($answer=="1"){settype($answer, "integer");
if(is_int($answer)){
//I want to echo the total value of $answer. Right now it gives me "1111" instead of "4" and I want 4.
}
?>
你至少可以發佈初始數組值? – Peon