fork download
  1. <?php
  2.  
  3. $d = array(5, 6.5, 10, 3.355, 400, 9.43);
  4. function change($c, $array)
  5. {
  6. foreach($array as $key=> $value)
  7. {
  8. $array[$key] = $value + $value * $c / 100;
  9. }
  10. return $array;
  11. }
  12. $d = change(2, $d);
  13. echo '<pre>';
  14. print_r($d);
  15. echo '</pre>';
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
<pre>Array
(
    [0] => 5.1
    [1] => 6.63
    [2] => 10.2
    [3] => 3.4221
    [4] => 408
    [5] => 9.6186
)
</pre>