The md5() function in PHP is used to calculates the md5 hash of a string.
Syntax
md5(str, raw)
Parameters
str − The string to be calculated
raw − Specify Boolean values
TRUE − Raw 16 character binary format
FALSE − Default. 32 character hex number
Return
The md5() function returns the hash as a 32-character hexadecimal number.
Example
The following is an example −
<?php $s = "Welcome!"; echo md5($s); ?>
Output
9a843f20677a52ca79af903123147af0
Example
The following is an example −
<?php
$s = "Welcome";
echo md5($s);
if (md5($s) == "83218ac34c1834c26781fe4bde918ee4") {
echo "\nWelcome";
exit;
}
?>Output
83218ac34c1834c26781fe4bde918ee4 Welcome