PHP md5() Function
In this chapter you will learn:
- Definition for PHP md5() Function
- Syntax for PHP md5() Function
- Parameter for PHP md5() Function
- Return for PHP md5() Function
- Example - Get the checksum for a string
Definition
The md5() function produces a data checksum in 32-bytes. "MD" stands for Message Digest.
Syntax
PHP md5() Function has the following syntax.
string md5 ( string str [, bool raw_output] )
Parameter
Parameter | Is Required | Description |
---|---|---|
string | Required. | The string to be calculated |
raw | Optional. | Hex or binary output format: |
Possible values for raw.
- TRUE - Raw 16 character binary format
- FALSE - Default. 32 character hex number
Return
PHP md5() Function returns the string for the checksum.
Example
Get the checksum for a string
<?PHP
$md5hash = md5("java2s.com");
print $md5hash;
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP metaphone() Function
- Syntax for PHP metaphone() Function
- Parameter for PHP metaphone() Function
- Return for PHP metaphone() Function
- Example - PHP metaphone() Function
- Example - Using the metaphone() function on two similar sounding words
- Example - Using the length parameter of the metaphone() function on two similar sounding words
Home » PHP Tutorial » PHP String Functions