Print the result of md5() and compare with a string value in PHP

Description

The following code shows how to print the result of md5() and compare with a string value.

Example


//from  w  w  w  . jav a  2s. c om
<?php
    $str = "Hello";
    echo md5($str);

    if (md5($str) == "8b1a9953c4611296a827abf8c47804d7"){
       echo "<br>Hello world!";
       exit;
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions