RE: [PHP] Stripping Characters

From: Date: Tue, 22 Jun 2010 15:45:32 +0000
Subject: RE: [PHP] Stripping Characters
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-306309@lists.php.net to get a copy of this message
Hello, can this resolve your problem? $trans = array( "from" => "to", "another" => "to"); $moditem = StrTr($moditem, $trans); -- http://cz.php.net/manual/en/function.strtr.php David -----Original Message----- From: Rick Dwyer [mailto:rpdwyer@earthlink.net] Sent: Tuesday, June 22, 2010 5:41 PM To: php-general@lists.php.net Subject: [PHP] Stripping Characters Hello List. I need to remove characters from a string and replace them with and underscore. So instead of having something like: $moditem = str_replace("--","_","$mystring"); $moditem = str_replace("?","_","$mystring"); $moditem = str_replace("!","_","$mystring"); ....etc. For every possible character I can think of, is there a way to simply omit any character that is not an alpha character and not a number value from 0 to 9? --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#306309) next »