PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I calculate the MD5 hash of a string?


If that question makes no sense to you at all, then you probably don't have a need for this right now!

However lots of people do, and the good news is that it's really easy with the built-in PHP function, so here goes with the answer:

<?php
$text 
"Give me some space";

$md5 md5($text);

?>


That's all there is to it. And for those of you still wondering what this is all about, essentially it's a secure hashing function. The interesting thing is that no matter how long the data stream it converts it into a digest of a fixed size.



More strings PHP Questions

How can I remove spaces from around a string value?
How do I make the first letter of each word upper case?
How do I make the first letter of a string uppercase?
How do I join strings together?
How do I print the " in an echo statement?