PHP md5() Function Example

PHP Script:

<?php
$str=”PHP TUTORS md5 FUNCTION EXAMPLE”;
echo md5($str);
?>

Output:

cb97a255c33139010701c7a68c05d689

Description:

PHP md5() function calculates the MD5 hash of a string.
This function returns the calculated MD5 hash on success, or FALSE on failure.
It can be used to store password in database as encrypted form [md5 hash].

PHP md5 function parameters:

1- String: String for which md5 hash is going to be calculated.
2- Bolean value [optional]:
TRUE is for Raw 16 character binary format.
FALSE is for 32 character hex number.
By default value is FALSE.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s