Back in earlier days of the internet, most files took a long time to download, and users frequently found they ended up with corrupted downloads. Even today, with ADSL and cable modems being common place, many downloads take a little time to complete, and errors still do occur.
To combat the chance of people downloading bad files and not realising, and also to make sure people know they have an official copy of a file/program, it became popular practice to create a checksum hash value using algorithms such as SHA1. By attaching a hash value this way allows downloaders to check their copy of a file to make sure it matches the web site's hash value - if it does not, the file is not the same.
Because this process of checksumming files is so common, there is a function specifically for it, sha1_file(), which works in roughly the same way as the sha1() function we looked at previously - you feed it the filename of a file you want to checksum, and it returns the SHA1 hash value.
Given the variable $filename is set to a valid filename, these two lines of code are functionally identical: