How to Encrypt a String in PHP?

In this post, we build-in function to encrypt large files. openssl_encrypt() can be used to encrypt strings in php.

1. Code:

     

2. Example:

Input:

String input: "Soltuts.com is providing PHP tutorials, tips, tricks and code snippets"

Output:

output: "amQi1iV7IjGKQ55/6aIzBhFY82eL6ReVxs47W+bhLAjG7rPa7U1dYe437UhJitO7TvG+CZL0oNH/N0qMHnw86T2ZAVMVEmu506xg6MzyKpLgKUHNozBbmJ0By2XDuKkHaZb0rZ06rfEmjurDzwgDtQ=="