Frequently Asked Questions
These questions are meant help you solve specific but common problems that may pop up when using this language. They are meant to be read after you have gone through the tutorial and begin actual development.
Many of these questions and answers are taken from the official php.net faq maintained by the developers of php. If you can't find the question(s) you are looking for on this page try searching through that page.
Refer to this url for an example of a php script that would accomplish this task.
How can I securely store data?
For a variety of reasons you may want to store a piece of information in a way that ensures no unauthorized access occurs. This might be a user's password or social security number. Simply putting the piece of information in a secured database is not enough. In order to use this you will need to use a hashing function which magically, using complex mathematics, turns your string into a random mix of characters. For any given string the resulting random mix of characters is always the same allowing you to know if two pieces of data are the same without actually knowing what they are.
We recommend using crypt() because for most cases this will accomplish what you need without complication of the problem. Using crypt() is as easy as passing in a string and getting a hashed string in return. You can then compare hashes to see if a hashed string is equal to another hashed string.
You will want to refer to the crypt() php.net manual for further description on how to use it along with code samples.