fork download
  1. <?php
  2. $bills = array(
  3. 100 => 23,
  4. 500 => 5,
  5. 1000 => 0,
  6. 5000 => 200
  7. );
  8. $reverse = array_flip($bills);
  9. $billsSum = array(
  10. 100 => $bills[100]*$reverse[23],
  11. 500 => $bills[500]*$reverse[5],
  12. 1000 => $bills[1000]*$reverse[0],
  13. 5000 => $bills[5000]*$reverse[200]
  14. );
  15. print_r($billsSum);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [100] => 2300
    [500] => 2500
    [1000] => 0
    [5000] => 1000000
)