$file = 'example.txt'; if (file_exists($file)) { $file_md5 = md5_file($file); echo $file_md5; }
$password = '12345'; $password_md5 = md5($password); echo $password_md5;In this example, the md5() function is used to hash the user's password "12345". The resulting hash is stored in the variable $password_md5 and printed to the screen. Package Library: This function is a PHP built-in function and does not require a package library. In conclusion, the PHP function md5() is a useful tool for ensuring data integrity, protecting passwords and verifying digital signatures. It is a built-in function of PHP and does not require a package library.