Hash each file. Names differ, but contents are equal.
Compare the hashes. Equal hashes mean matching content.
Delete the temp files. Good habit for demo code.
Frequently Asked Questions
sha1_file() reads a file and returns the SHA-1 hash of its contents as a 40-character hex string. You do not need to load the file into a variable first.
sha1_file(string $filename, bool $binary = false): string|false. Pass the file path. Set the second argument to true for raw binary output.
PHP raises a warning and sha1_file() returns false. Check the result with === false before using it.
No. Only the file contents matter. Two files with different names but the same content give the same hash.
sha1() hashes a string you already have in memory. sha1_file() opens a file by path and hashes what is inside it.