Function to strip returns
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Function to strip returns

From: JackM <notme@earthlink.net>
Date: Mon Oct 31 2005 - 01:16:00 CET

I'm trying to write a function that will trim and strip new line
character returns from submitted $_POST values. Does this look serviceable?

function trim_data($formdata)
  {
   foreach ($formdata as $key => $value)
       {
         $value = preg_replace("(\r\n|\n|\r|\t)", "", $value);
         $newdata[trim($key)] = trim($value);

      }
   return $newdata;
  }
Received on Mon Nov 21 02:53:14 2005