PHP md5() Function

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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions