title: String replace all items in array PHP
body: <p>I would like to do a string replacement in all items in an array. What I have is:</p>
  
  <pre><code>$row['c1'] = str_replace("&amp;", "&amp;amp;", $row['c1']);
  $row['c2'] = str_replace("&amp;", "&amp;amp;", $row['c2']);
  $row['c3'] = str_replace("&amp;", "&amp;amp;", $row['c3']);
  $row['c4'] = str_replace("&amp;", "&amp;amp;", $row['c4']);   
  $row['c5'] = str_replace("&amp;", "&amp;amp;", $row['c5']);
  $row['c6'] = str_replace("&amp;", "&amp;amp;", $row['c6']);
  $row['c7'] = str_replace("&amp;", "&amp;amp;", $row['c7']);   
  $row['c8'] = str_replace("&amp;", "&amp;amp;", $row['c8']);
  $row['c9'] = str_replace("&amp;", "&amp;amp;", $row['c9']);
  $row['c10'] = str_replace("&amp;", "&amp;amp;", $row['c10']); 
  </code></pre>
  
  <p>How can I achieve this with less code? I thought a foreach statement would  work,  e.g.:</p>
  
  <pre><code>$columns = array($row['c1'], $row['c2'], $row['c3'], $row['c4'], $row['c5'], $row['c6'], $row['c7'], $row['c8'], $row['c9'], $row['c10']);
  
  foreach ( $columns as $value){
     $value   = str_replace("&amp;", "&amp;amp;", $value);
  }
  </code></pre>
  
  <p>But it doesn't work.</p>