Here i am sharing php functions for encrypt decrypt a string. I came across two different ways of encrypt decrypt php functions for string. In first one, there are two functions for encrypt and decrypt string. One is for encrypt the string and other is for decrypt the encrypted string. In second one, there is only one encrypt decrypt function which works for both encryption and decryption of string in php.