RE: Stripping Characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx] 
Sent: Tuesday, June 22, 2010 5:41 PM
To: php-general@xxxxxxxxxxxxx
Subject:  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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux