Faster word search?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Faster word search?

Post by elmonty »

I'm doing a word search of a very large text file. Currently, I am using the following code to do the searching:

Code: Select all

$pattern = '/\b' . $term . '\b/i';
$found   = preg_match($pattern, $msg);
Is there a faster way to search for a word other than using a regexp? I only want to find whole words.
Post Reply