Calculate the md5 hash of a string
Syntax
md5(string $string, bool $binary = false): string
Parameters
string
The string.
binary
If the optional binary is set to true, then the md5 digest is instead returned in raw binary format with a length of 16.
Return
Returns the hash as a 32-character hexadecimal number.
Examples
1 · string
<? $string = 'Hello'; $return = md5($string); echo $return; ?>
8b1a9953c4611296a827abf8c47804d7
2 · binary
<? $string = 'Hello'; $binary = true; $return = md5($string, $binary); $unpack = unpack('H*', $return); $array_pop = array_pop($unpack); echo $array_pop; ?>
8b1a9953c4611296a827abf8c47804d7