Re: array trim

From: Date: Tue, 17 Sep 2002 19:53:34 +0000
Subject: Re: array trim
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-116662@lists.php.net to get a copy of this message
How about: function my_replace($x) { return str_replace("","",$x); } $b = array_map("my_replace",$_POST); The $b will have your fixed array. This all begs the question, though, of why you need to do this. Are you trying to get rid of slashes or single/double quotes by any chance??? ---John Holmes... ----- Original Message ----- From: "Kevin Stone" <kevin@helpelf.com> To: <icgphp@icecoldgold.com>; "PHP-General" <php-general@lists.php.net> Cc: "php-general" <php-general@lists.php.net> Sent: Tuesday, September 17, 2002 3:32 PM Subject: Re: [PHP] array trim > Assuming every value needs to be modified in the same way.. > > foreach ($_POST as $key => $val) > { > $_POST[$key] = str_replace("a", "b", $val); > } > > -Kevin > > ----- Original Message ----- > From: <icgphp@icecoldgold.com> > To: "PHP-General" <php-general@lists.php.net> > Cc: "php-general" <php-general@lists.php.net> > Sent: Tuesday, September 17, 2002 12:44 PM > Subject: [PHP] array trim > > > > > > Hello, > > > > is their a way to go through the $_POST array and do a str_replace on each > one so i do not have to do this > > > > > > $_POST[""]=str_replace("",""$_POST[""]); > > > > to each of the POST variables? > > > > > > Thanks > > > > Randy > > > > > > > -------------------------------------------------------------------------- -- > ---- > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#116662) next »