How do I one-way encrypt a string in PHP?
<?php
$mydata = 'mypassword';
$code = crypt($mydata);
?>
Remember that this is a one way function, so if you use this when storing user password information, for instance, you will not be able to send them a password reminder but rather will need to identify them based on some other info (e.g. username and email combo) and then let them reset a password.
More strings PHP Questions
How can I remove spaces from around a string value?How do I replace a word in a string in PHP?
How do I add commas easily to a string of numbers?
What is the difference between ' and "?
How do I find the length of a string in PHP?