O'Reilly logo

Wicked Cool PHP by Brian Ward, William Steinmetz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

#38: Finding and Fixing Misspelled Words with pspell

Anyone who's used Google has misspelled a word in a search, for example, alternitive music. And Google always helpfully comes back with Did you mean alternative music?

If you have a search function on your site, the ability to suggest misspelled words when no results (or not enough results) are found is an extremely helpful feature, especially since a customer's lack of spelling ability might cost you a sale. Fortunately, there's a PHP module called pspell, which allows you to check a word's spelling and suggest a replacement from pspell's default dictionary. If you like, you can even create a custom dictionary. To start with, though, you'll need to make sure that your PHP has the pspell library ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required