I found in this site a very basic javascript function to encode text. Looking at the source code this is the string replacement code:
txtEscape = txtEscape.replace(/%/g,'@');
So the string stackoverflow becomes @73@74@61@63@6B@6F@76@65@72@66@6C@6F@77
I need a function that does the same elementary encryption in php, but I really don't understand what the /%/g does. I think in php the same function would be something like:
str_replace(/%/g,"@","stackoverflow");
But of course the /%/g doesn't work
.replace(/%/g,'@');only replaces%characters with@, so it does nothing for thestackoverflowstring. You should post the rest of your js in order to trace down what's doing the trick. :)