Re: String searching peformance
| From: | Jason Wong | Date: | Wed, 26 Feb 2003 09:47:41 +0000 |
| Subject: | Re: String searching peformance | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137209@lists.php.net to get a copy of this message | ||
On Wednesday 26 February 2003 16:49, {R}ichard Ashton wrote:
> Do you think that:
>
> if (preg_match($re, $posting, $hits)) would slow it down at all. The
> $buzzwords will be kept in a file to be loaded before each run, every 5
> minutes. I could therefore keep a count of which words hit most
> frequently and move them to the top of the list.
No idea whether this would be faster (it's certainly easier to code):
explode() text into an array
place your banned words into an array
array_intersect() to find words common in both
Do your own benchmarking!
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Why is the alphabet in that order? Is it because of that song?
-- Steven Wright
*/