Re: Removing special chars

From: Date: Wed, 26 Apr 2006 05:07:33 +0000
Subject: Re: Removing special chars
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234767@lists.php.net to get a copy of this message
Gerry Danen wrote:
I would like to replace all chars in a string that are not a-z or 0-9 with a space. I can use a series of str_replace functions, but there has to be a faster way. I know there is a solution but my chemo-brain is slowing me down today. Sorry... Any suggestions? TIA Gerry Not sure which would be easier or faster - but str_replace can take an array (black list approach) , or use preg_replace so you can do a white list approach.
-- life is a game... so have fun.

« previous php.general (#234767) next »