filesAreEqual.php
Table of Contents
Functions
- filesAreEqual() : bool
- Tells whether two files have identical contents.
Functions
filesAreEqual()
Tells whether two files have identical contents.
filesAreEqual(string $a, string $b[, string $algorithm = 'sha256' ]) : bool
The comparison is short-circuited for speed:
- if both paths resolve to the same file on disk, returns
truewithout reading; - if the file sizes differ, returns
falsewithout hashing; - otherwise the files are compared by fileChecksum().
Parameters
- $a : string
-
Path to the first file.
- $b : string
-
Path to the second file.
- $algorithm : string = 'sha256'
-
A hashing algorithm supported by hash_algos() (default:
'sha256').
Tags
Return values
bool —true if both files have identical contents, false otherwise.