Page 1 of 1

file comparision

Posted: Tue Sep 05, 2006 11:00 pm
by swaruu
how do i compare two files in php ? can anyone help me ?

Posted: Wed Sep 06, 2006 1:44 am
by Oren

Posted: Wed Sep 06, 2006 1:45 am
by thallish
you can use file() or file_get_contents(), and the compare the arrays or strings

dont know if this is the most effective way though

EDIT: Oren's response is better :lol:

Posted: Wed Sep 06, 2006 2:52 am
by Ollie Saunders
md5_file is great for testing equality but not much else. What exactly is the comparison based on?

Posted: Wed Sep 06, 2006 3:34 pm
by feyd
use filesize() before using md5_file(). Why spend time doing an md5 hash if they are different sizes. :P