Discussion: Comparing files
Afficher un message
Vieux 12/03/2008, 13h13   #5
Edward Kay
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [PHP] Comparing files



> -----Original Message-----
> From: mathieu leddet [mailto:mathieu.leddet@mobilescope.com]
> Sent: 12 March 2008 11:04
> To: php-general@lists.php.net
> Subject: [php] Comparing files
>
>
> Hi all,
>
> I have a simple question : how can I ensure that 2 files are identical ?
>
> How about this ?
>
> --------8<------------------------------------------------------
>
> function files_identical($path1, $path2) {
>
> return (file_get_contents($path1) == file_get_contents($path2));
>
> }
>
> --------8<------------------------------------------------------
>
> Note that I would like to compare any type of files (text and binary).
>
> Thanks for any ,
>


Depending upon the size of the files, I would expect it would be quicker to
compare a hash of each file.

Edward

  Réponse avec citation
 
Page generated in 0,05074 seconds with 9 queries