Re: [PHP] Re: Replacing whole words only

2004-12-22 Thread Richard Lynch
Daniel Schierbeck wrote: > Chris Boget wrote: >> Is there a way to replace/remove *whole* words from a >> phrase? For example: >> >> > $exceptionsList = array( 'the', 'other', 'that', 'a' ); >> $stringToParse = 'The other lady that laughed'; >> >> if( count( $exceptionsList ) > 0 ) { >>

[PHP] Re: Replacing whole words only

2004-12-22 Thread Daniel Schierbeck
Chris Boget wrote: Is there a way to replace/remove *whole* words from a phrase? For example: if( count( $exceptionsList ) > 0 ) { foreach( $exceptionsList as $exceptionPhrase ) { $stringToParse = str_replace( $exceptionPhrase, '', trim( $stringToParse )); } $retval = trim( $s