How to get a PHP Spell Checker for your website

Most servers have a php spell functionality already installed. Check with your host whether php has been compiled with "pspell".

You can easily add a spell check feature on your website using pspell.

Here's a very simple script to demonstrate the use of pspell. Try it by creating a new empty file called "phpspell.php" and copy and paste the following code into it. To use it, enter in your browser the URL
http://yourdomain.com/phpspell.php?word=tesst

(replace tesst with any word to check)

This little script will give you the best alternative suggestion for the word.

<?
$pspell_link 
pspell_new("en");

if (!pspell_check($pspell_link$word)) {
    
$suggestions pspell_suggest($pspell_link$word);
echo 
$suggestions[0];
} else {
echo 
$word;
?>


This is just a simple example. You can get a full spell checker functionality with pspell. Naka Gadjov has made a nice script which I have used with success. Check out his free script to make the most of pspell functionality:

PHP Spell Checker




Google
 
Web innerblogger.com




Leave a Reply