I have a problem to sum the values using foreach.

I want to add the value of 12000 to 11000 but the result is only 11000, which is the last data.
$no = 1;
foreach ($record->result_array() as $calc) {
    $sum = 0;
    $sum += $calc['harga_jual'] - $calc['diskon'];
    $no++;
}
 
     
     
    