What is the md5 function in PHP?
The md5 function in PHP computes the md5 hash of a string.
md5should not be used to encrypt passwords because it is a high-speed algorithm and can easily be brute-forced to reveal the original input.
Syntax
md5(string $str, bool $binary = false): string
Parameters
$str: the string you want to hash.$binary: a Boolean to specify if the result should be in raw binary form (if set toTrue) or a hexadecimal number (if set toFalse). The default value isFalse.
Return value
It returns a hash value of the string in the form as specified by $binary.
Code
This simple example will compute the md5 hash of a string:
<?php$myhash = md5("Hello, educative!");echo "Hash: " . $myhash;