Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

md5_file

Description

The md5_file of String for PHP calculates the md5 hash of a given file.

Syntax

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

Parameters

filename

The filename.

binary

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

Return

Returns a string on success, false otherwise.

Examples

1 · filename

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = md5_file($filename);

echo $return;

?>
5d41402abc4b2a76b9719d911017c592

2 · binary

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$binary = true;

$return = md5_file($filename, $binary);

echo $return . PHP_EOL;

$format = 'H*';

$unpack = unpack($format, $return);

$array_pop = array_pop($unpack);

echo $array_pop;

?>
]A@*�K*v�q��Œ
5d41402abc4b2a76b9719d911017c592
HomeMenu