Функция выделяет красным цветом слова с орфографической ошибкой. Требует наличия pspell на хостинге
<php
function orfograf($text, $l="ru")
{
$pspell_link = pspell_new($l);
$a=$text;
$text_s=$text;
$array_razdelitel=array(" ",".",",","!","?",";",":","_","=","+","&","@","\"","'","(",")","<",">","\\","/","`","~","\$","[","]","{","}","|","#","%","^","*",);
$a=str_replace(PHP_EOL, " ", $a);
$a=str_replace($array_razdelitel," ",$a);
$a=str_replace(array('1','2','3','4','5','6','7','8','9','0','№',), "", $a);
$a=preg_replace('| +|', ' ', $a);
$a=explode(" ",$a);
$errors='';
foreach($a as $v)
if(!pspell_check($pspell_link, $v))
{
$slova = pspell_suggest($pspell_link, $v);
$text=str_replace($v, "<font color=\"red\">$v</font>", $text);
$text_s=(strlen($slova[0])>0)?str_replace($v, $slova[0], $text_s):$text_s;
}
return $text;
}
?>