How rot13 on a string using PHP?

7k Views Asked by At

I have a big php code that i want to encode and decode it manually.
My problem is that php code has many single quotes and double quotes inside and because of them i have errors while using str_rot13() function like below...
So what is the correct syntax and how can I use the function below for encode:

str_rot13 ('That php Code');

And how can i decode that encoded file? I couldn't find a reverse function!

thanks in advance

2

There are 2 best solutions below

3
On BEST ANSWER

The nice thing about rot13 is that it's reflective. applying rot 13 twice (e.g. rot 26) brings you right back to where you came from.

4
On

Rot 13 is only designed to handle the 26 characters of the standard English alphabet. If you need more characters, you might want to have a look at ROT47 which is briefly explained here