Xử lý file text với PHP – Text file with php

1/ So sánh 2 file text:

Dùng function hash_file(“giải thuật: md5, sha256…”, “tên file”);

ví dụ (đã test):

$ash1 = hash_file(“md5″,”1.txt”);
$hash2 = hash_file(“md5″,”2.txt”);
if ($hash1 !== $hash2){
echo “2 file khac nha \n”;
}
if ($handle) {
while (($line = fgets($handle)) !== false) {
echo $line;
}
    fclose($handle);
} else {
// error opening the file.
}
?>