I'm also an idiot ...
Something else, the "or" output is occurring because the exception "the"
matches "other " first so "other" becomes "or" minus the "the"...
So heres what I did ...
$search = array( '/\bthe\b/', '/\bother\b/', '/\bthat\b/', '/\ba\b/' );
$string = 'The other lady that laughed';
if( count( $search ) > 0 ) {
foreach( $search as $exceptionPhrase ) {
$string = preg_replace( strtolower($exceptionPhrase), '',
strtolower($string));
}
$retval = trim( $string );
}
echo 'Retval: ' . $retval . '<br>';
And got
lady laughed
In the matches ex. "/\bthe\b/" the \b mean word boundry so
it matches only the whole word...
-David
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php