i make 2 arrays in PHP and i added value in array here
$num_a = array(2,4);
$num_b = array(8,12);
i make a conditional for calculate total value in array like this using foreach loop like this, i declared the total = 0
so that there are no random numbers in it
$total_a = 0;
$total_b = 0;
foreach($num_a as $key => $a){
$total_a += $a;
$total_b += $num_b;
}
so i check the result but it's have an error
$result = $total_a/$total_b;
the error is :
Fatal error: Uncaught DivisionByZeroError: Division by zero in line 52
i know the error because it's cannot doing operation zero in value variable, but here i have fill the value using foreach loop, so how it can be? and how to solve this, thank you...