I never use this function, since I always use regular expressions, but
according to the manual:
If you don't need fancy replacing rules (like regular
expressions), you should always use this function instead of
ereg_replace() or preg_replace().
So, I assume your problem initially was that you were using regular
expression syntax and this function doesn't accept regular expressions.
Is your aim to get rid strings of all the items in the $noiseArray? Your
$noiseArray includes the entire alpahabet, so it's no wonder that you
end up with empty strings!
Myron
Dotan Cohen wrote:
On 29/10/06, Alan Milnes <css@xxxxxxxxxxx> wrote:
Dotan Cohen wrote:
> $searchQuery=str_replace( "^".$noiseArray."$", " ", $searchQuery);
Can you explain what you are trying to do with the ^ and $? What is a
typical value of the original $searchQuery?
Alan
The purpose of the ^ and the $ is to define the beginning and the end of
a word:
http://il2.php.net/regex
I also tried str_replace( $noiseArray, " ", $searchQuery) but that was
replacing the insides of words as well. And with the addition of the
individual letters, that emptied the entire $searchQuery string!
A typical value of $searchQuery could be "What is php?" or "What is
open source". See this site for details:
http://what-is-what.com
Dotan Cohen
http://technology-sleuth.com/
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php