Javatpoint Logo
Javatpoint Logo

PHP string md5() function

PHP string md5() is predefined function. It is used to calculate the MD5 hash of a string. It uses the RSA DATA security. It returns the hash as a 32 character hexadecimal number.

Note: We should not use this function for secure passwords, due to the fast nature of this hashing algorithm.


Parameter Description Required/Optional
String Specify string to be calculated. required
raw Specify hex or binary format
  • TRUE - Raw 16 character binary format
  • FALSE - Default. 32 character hex number

Example 1


Your string is:PHP
By using md5() functon:2fec392304a5c23ac138da22847f9b7c

Example 2


'PHP' string is equall to encrypted string

Example 3


Your string is: PHP
TRUE - Raw 16 character binary format: /9# :8"??|
FALSE - 32 character hex number: 2fec392304a5c23ac138da22847f9b7c

Example 4


Your string is: PHP
By using md5() function: 2fec392304a5c23ac138da22847f9b7c

Note: The encrypted value "8b1a9953c4611296a827abf8c47804d7" is not equal to "PHP" string so Hello PHP message not displayed.

Next TopicPHP String

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA