Re: str_replace on words with an array

From: Date: Sun, 29 Oct 2006 21:07:15 +0000
Subject: Re: str_replace on words with an array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-243838@lists.php.net to get a copy of this message
On 29/10/06, Alan Milnes <css@milnes7.com> 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/

« previous php.general (#243838) next »