md5() function in PHP || PHP md5() function
×


md5() function in php

1989

PHP md5() function is used to generate the md5 hash of a PHP string. It is an inbuilt function of PHP. This function returns md5 hashed string after success and returns FALSE in case of failure.

Syntax:

md5($string,$fomat);

here,

1. $string is a PHP string. It is mandatory.

2. $format is the Boolean parameter which specifies the format of resultant string. It is optional. This parameter has two possible values.

a. TRUE: it represents 16 character binary format.

b. FALSE: it represents 32 characters hex number. By default it is selected.


Example:

<?php
$str="Welcome to Coding Tag";
$hashed_string=md5($str);
echo "Original string is : $str <br>";
echo "Hashed string is : $hashed_string";
?>

Output:


Example 2:

<?php
$str="123456";
$hashed_string=md5($str,FALSE); // 16 character binary format
echo "Original string is : $str <br>";
echo "Hashed string is : $hashed_string";
?>

Output:



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments