Показать сообщение отдельно

  #9  
Старый 09.11.2008, 20:49
Chode
Участник форума
Регистрация: 20.07.2008
Сообщений: 177
С нами: 9372902

Репутация: 54
По умолчанию

PHP код:
function Synonim($text,$SYNINCLUDEORIGINAL,$notsin=true){
    
$txt=$text;
    if(!
$notsin)return $txt;
    if(!
file_exists("./synonim.txt")) return $txt;
    
$handle fopen("./synonim.txt""r");
    
$contents ''$i=0;
    while (!
feof($handle)) {
        
$buffer fgets($handle4096);
        
$marr=explode("=",$buffer);
        
$original=$marr[0];
        
$synarr=explode(",",$marr[1]);
        if(
$SYNINCLUDEORIGINAL)$synarr[]=$original;
        
$syn=$synarr[rand()%count($synarr)];
        
$syn=str_replace("
"
,"",$syn);
        
$txt=str_replace(" ".$original." "," ".$syn." ",$txt);
        
$txt=str_replace(" ".$original.","," ".$syn.",",$txt);
        
$txt=str_replace(" ".$original."."," ".$syn.".",$txt);
        
$txt=str_replace(" ".$original."?"," ".$syn."?",$txt);
        
$txt=str_replace(" ".$original."!"," ".$syn."!",$txt);
        
$txt=str_replace(" ".$original.":"," ".$syn.":",$txt);
          
$i++;
    }
    
fclose($handle);
    
$result.=$txt;
    return 
$result;

вот тебе функция, переделывай сам =)
 
Ответить с цитированием