Hi there,
I am using the function preg_split to take apart a string entered into a search field in order to search a database for thier query. The deal is that I found this code in an example on php.net's manual, and it works good, but I don't understand how it works, basically the string pattern part.
$searchArray=preg_split ("/[\s,]+/", $query)
What this does, as it is now, is that if you enter in a string of words, it will split them up into the array.
Example:
$query="I love, monkies"
the array will be:
$searchArray[0]=I
$searchArray[0]=love
$searchArray[0]=monkies
it gets rid of the comma, which is nice. I would also like it to get rid of other punctuation mark, such as quotes and semi-colons, but I'm not sure how to do that. If anyone could shed some light on this, I'd appreciate it. Thanks