I have a really simple question but for some reason the output is not what I want. I have 2 arrays:
total_hours = array(10, 20, 30);
hourly_rate = array(15, 10, 15);
So what I want to work out is how to multiple the corresponding element of total_hours with the hourly_rate (e.g. element 1: 10*15 = 150) then put this into an array called total_sum (total_sum has been initialized) . This is what I've done so far:
$total_sum = 0;
for($i=0; $i < sizeof($hourly_rate); $i++) {
for($a=0; $a < sizeof($total_hours); $a++) {
$total_sum = ($hourly_rate[$i]*$total_hours[$a]);
}
$total_pay[] = $total_sum;
}
At the moment I get 0 and don't understand why.
Many thanks!