I'm pulling values from two different arrays to produce new arrays with only the values I want. Here are the two scripts. I'm basically finding the total revenue for all teams within a game.
Script 1
$allSales = array();
foreach ($game['sales'] as $sale) {
foreach ($sale['values'] as $id => $values) {
$allSales[$id]+=$values['y'];
}
}
print_r($allSales);
Script 2
$allPrices = array();
foreach ($game['products'] as $id => $product) {
$allPrices[$id]+=$product['Price'];
}
print_r($allPrices);
The values I get look something like this:
Array ( [0] => 500000000 [1] => 300000000 )
Array ( [0] => 300 [1] => 600 )
I want to be able to multiply the one array against the other in the same order of position. So 500000000 * 300 and 300000000 * 600 and produce a new array.
The reason I want a new array is because I will be sorting them from largest to smallest value and adding ranks to all of the values. I have another variable that has determined the current teams total sales revenue which I will compare to find their rank.