Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私の array_sum 関数が正しく加算されていないようです。結果は「0」で、アイテムが追加されていないことを示しているようです。
$a = array(); foreach ($ct->data as $key => $value) { $a[$ct->data[$key][3]]; } $totalAmount = array_sum($a);
実際には配列に何も入れていません。配列に値を設定し、値に必要な値をキーに与え、値をnullのままにしています。試す$a[] = $ct->data[$key][3];
$a[] = $ct->data[$key][3];