Thread: PHP Application
View Single Post
Old 08-18-2003, 11:57 PM   #3 (permalink)
Larry
Larry's Avatar
 

Join Date: May 2003

Posts: 1,797

Larry has disabled reputation

Default php file compare...

About comparing 2 files, you can open each file, read character for character and compare them.

here is some code I have to read a file, I'm sure you can tweak it to fit your needs

function FileCompare() {

$file_data1 = fopen ("/path_to_file/file1.txt", "r");
$file_data2 = fopen ("/path_to_file/file2.txt", "r");

while (!feof ($file_data)) {
$record = fgets($file_data);
$ra = split( ',', $record);
//open other file and read/compare the characters

}
fclose($file_data);
}
Larry is offline