array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.md5-file.php', 1 => 'md5_file', 2 => 'Calculates the md5 hash of a given file', ), 'up' => array ( 0 => 'ref.strings.php', 1 => 'String Functions', ), 'prev' => array ( 0 => 'function.md5.php', 1 => 'md5', ), 'next' => array ( 0 => 'function.metaphone.php', 1 => 'metaphone', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/strings/functions/md5-file.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

md5_file

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

md5_fileCalculates the md5 hash of a given file

Description

md5_file(string $filename, bool $binary = false): string|false

Calculates the MD5 hash of the file specified by the filename parameter using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal number.

Parameters

filename

The filename

binary

When true, returns the digest in raw binary format with a length of 16.

Return Values

Returns a string on success, false otherwise.

Examples

Example #1 Usage example of md5_file()

<?php
$file
= '/examples/book.xml';

echo
'MD5 file hash of ' . $file . ': ' . md5_file($file);
?>

See Also