str_replace to ignore commas

From: Date: Tue, 06 Jan 2004 14:29:31 +0000
Subject: str_replace to ignore commas
Groups: php.general 
Request: Send a blank email to php-general+get-173844@lists.php.net to get a copy of this message
I'm trying to use str_replace to ignore sertain characters from a recordset field and it seems I am having difficulties with ignoring commas and carriage returns. I've gotten the following but when searching for, let's say, New York. When York is at the end of a sentence from a recordset field it is skipped and if it has a comma like York, it is skipped. Any ideas? Here's the code I'm using so far //IGNORED CHARACTERS $replacement = array("\"", "\,", ".", "!", "?"); //CREATE THE ARRAY OF WORDS //STRIP SLASHES, IGNORE CAPS, IGNORE REPLACEMET CHARACTERS //$keywords = form field value $words=explode(" ", stripslashes(strtolower(str_replace($replacement, "", $keywords))));

« previous php.general (#173844) next »