Forum Moderators: coopster
What I'm trying to do is a very simple obsification of a string.
Think of those secrete encoder/decoder alphabet codes people make in elementary school. Where A=>B, B=>E, C=>R, D=>A...
Here's what I have so far:
$message="ab";
$encoded=str_replace(array("a","b"),array("b","e"),$message);
echo $encoded;
What I would have liked as an output whould have been "be", but the current script then replaces the newly converted b to an e in the second replace to give an actual output of "ee".
How can I modify this script to not replace elements that have already been replaced?
Thanks