title: how do you call a function inside a foreach statement
body: <p>I am trying to use foreach statment to run through a function that preg_replaces using regular expression. Can someone help, because my method doesn't work..</p>
  
  <pre><code>$reg_sent is an array
  
  function reg_sent($i){
    $reg_sent = "/[^A-Za-z0-9.,\n\r ]/";
    return preg_replace($reg_sent, '', $i);
  }
  
  foreach($reg_sent as $key=&gt;$value){
    $value = reg_sent($value);
  }
  </code></pre>