what is the syntax of the MD5_FILE() function in php?
md5_file(file,raw)
Parameter | Description |
---|---|
file | Required. The file to be calculated |
raw | Optional. A boolean value that specifies hex or binary output format:TRUE – Raw 16 character binary formatFALSE – Default. 32 character hex number |
examples of the MD5_FILE() function
Example 1. In this example, we calculate the MD5 hash of the text file “test.txt”.
<?php
$filename = "test.txt";
$md5file = md5_file($filename);
echo $md5file;
?>
Example 2. In this example, we store the MD5 hash of “test.txt” in a file.
<?php
$md5file = md5_file("test.txt");
file_put_contents("md5file.txt",$md5file);
?>