Delete Certain String in Text Files Using PHP
<pre><code>&lt;?php

    //reference text
    foreach (glob("file1.txt") as $filename1) {         
    $file1 = $filename1;
    $line1 = rtrim($file1, "\n");
    $contents1 = file($line1, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
    $string1 = implode($contents1); // file_put_contents('google.txt',implode('',$contents1));   
    $array1 = str_split ($string1 );
    $temp = $array1;        
    }

    //fetch from website
    $url ="https://www.example.com/";
    $str = file_get_contents($url);

    $myFile = "file2.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");
    $stringData = $str;
    fwrite($fh,$stringData);
    fclose($fh);

    foreach (glob("fetch_hLeong.txt") as $filename) {   
    $file = $filename;
    $line = rtrim($file, "\n");
    $contents = file($line,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $string = implode($contents);
    $array = str_split($string);
    $temp1 = $array;
</code></pre>

<p>}</p>

<p>//compare
$result = array_diff_assoc($temp, $temp1);
if (!count($result))
echo "<br>File  => MATCH"; 
else 
echo "<br>File  => NOT MATCH";</p>

<p>?></p>

<p>So i have this type of code, im going to compare those file1.txt and file2.txt.
Here i put each of the character in text files into an array and i compare it character by character. 
So my problem is, while comparing the code show NOT MATCH, which actually it is match.
The www.example.com has news feed that make it change every second because of that my files show NOT MATCH.</p>

<p>i want to delete certain string which is the newsfeed in the file1.txt so that it wont effect the process. Anyone ?? Thanks for your help .</p>
