Sometimes you need to store the data in database in encrypted format.
No worries, use these below very simple function to encode and decode string in php.
Below are the functions for doing same and is very easy to use, you can customize these as per your requirement to make it very strong encoded.
PHP Function for encrypt a string
<?php /** * Function to encrypt the string * will provide you a very strong encoded string */ function encode5t($str) { for($i=0; $i<5;$i++){ //apply base64 first and then reverse the string $str=strrev(base64_encode($str)); } return $str; } ?>
Function to decrypt the encrypted string
<?php /** * Function to decrypt the string (that was previously encoded) */ function decode5t($str) { for($i=0; $i<5;$i++){ //apply reverse the string first and then base64 $str=base64_decode(strrev($str)); } return $str; } ?>
Nice post. I just discovered your website and have to say that I have really enjoyed reading your blog content. Anyway I’ll be subscribing to your feed and I watch for your post another time soon.