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

  #4  
Старый 28.05.2008, 21:17
Buffalon
Постоянный
Регистрация: 22.03.2008
Сообщений: 325
Провел на форуме:
1208132

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

Как сравнить 1 слово в 1 файле со всем 2 файлом?ЗАтем 2 слово ..итд... .Додумался тока до
$file3=file_get_contents($file1);
$file4=file_get_contents($file2);
$file3=str_replace("\n",' ',$file3);
$file3=str_replace("\r",' ',$file3);
$file3=str_replace(",",' ',$file3);
Без использовани(array функций)
ВСё оК.. .Сам сделал
PHP код:
<?
if(!empty($_POST[submit])&&!empty($_POST[file1])&&!empty($_POST[file2]))
{


$file1=$_POST[file1];
$file2=$_POST[file2];
$file5=fopen($file1,'rb');
$file6=fopen($file2,'rb');



}
?>
<table width=100% height=20% border=0 ><tr><td>
<form method='POST' align=right>
file1:<input type=text name='file1'>
file2:<input type=text name='file2'>
<input type=submit name=submit>
</form>
</td></tr></table>


<table bgcolor="white" border="1" cellpadding="1" cellspacing="1" width="100%">
<tr bgcolor="#eeeeee">
<td width=50%>
old version<br>
<?echo $_POST[file1];?>
</td>
<td>
new version<br>
<?echo $_POST[file2];?>
</td>
</tr>
</table>
<br>
<!-- by Mylenka-->
<?
if(!empty($_POST[submit]))
{
//while(!feof($file3))
//{


while($f=fread($file5,1))
        {if(
$f=="\n" or $f=="\r" or $f=="." or $f=="," or $f=="/"){$f=' ';}
        
$s .= $f;$num1=ftell($file5);
            if(
$f==' ')
            {if(
$s==' '){continue;}fseek($file6,0,SEEK_SET);
              while(
$j=fread($file6,1))
                {if(
$j=="\n" or $j=="\r" or $j=="." or $j=="," or $j=="/"){$j=' ';}
                
$t .= $j;$num2=ftell($file6);
                    if(
$j==' ' or $j=="\r")
                    {
                    if(
$s==$t){echo $num1.'<font color=red>cимвол =></font>'$s .'<font color=red>совпадает с </font>'.$num2.'<br>'; }$t=NULL;
                    }
                }
$s=NULL;
            }  
        }
    }
?>
<b><br><font color="black" size="-2">MYLENKA</font></b>
Эт кому итересно

Последний раз редактировалось Buffalon; 28.05.2008 в 23:31..
 
Ответить с цитированием