title: Change filename in array with foreach loop
body: <p>I have the this array</p>
  
  <pre><code>Array(
  [0] =&gt; Array
      (
          [value] =&gt; /4/9/492.jpg
      )
  
  [1] =&gt; Array
      (
          [value] =&gt; /4/9/493.jpg
      )
  
  [2] =&gt; Array
      (
          [value] =&gt; /4/9/494.jpg
      )
  
  [3] =&gt; Array
      (
          [value] =&gt; /4/9/495.jpg
      )
  
  [4] =&gt; Array
      (
          [value] =&gt; /w/i/witbox_schwarz.jpg
      )
  
  )
  </code></pre>
  
  <p>I would like to change the values with a new filename following this scheme.</p>
  
  <pre><code>$n = count($arr);
  foreach ($arr as $key =&gt; $value) {
    for ($i = 0; $i &lt; $n; $i++) {
      if ($key == $i) {
        echo 'old filename is ' . $value . ' ... new filename will be ' . $prod_result['products_id'] . '_' . $key . '.' . pathinfo($value, PATHINFO_EXTENSION); 
      }
    }
  }
  </code></pre>
  
  <p>Everything is fine but I don't get the old value from the array within my foreach loop.</p>