How to do encrypt a string in PHP?

Encryption converts our string into some random characters there by making it difficult for hackers to know the real string. It is always recommended to encrypt the passwords of your website users before saving it to a database.

Here we will be using “crypt()” function in PHP for encryption. The method defined here will not let your users to reset their passwords via reset form. Here is the code which can be used for encryption.

crypt

The strip tags function used here helps in removing the HTML tags.