I am having a problem with the md5() function. I was playing around with this function. But I am stuck at a point.
<?php
$name = 'Taif';
if (md5($name) == $name){
echo 'True';
} else{
echo 'False';
}
?>
Why is it printing out False?
md5() is a php function used to encrypt plain texts. For example: converting a plain text(ie. password) into encrypted text .
In your code, the value of $name
is "Taif" while the value of md5($name)
is "40f245f002555c4a6105d6066d2bdb85"
So it is impossible for it to return "True" because they are totally different values.
MD5:
string md5 ( string $str [, bool $raw_output = FALSE ] )
Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash.