I'm new in PHP.
I want to make a simple encryption function in PHP that change a string to new string by changing characters.
For doing this, I create two arrays of characters.
In the first array I assign all characters and sorting them like :
$true_chars = array('a','b','c','d','e');
In another array, I change the position of the characters.
$fake_chars = array('c','d','a','e','b');
My goal is, when the function gets the right string, change the string characters by Replacing the second array.
For example, my string is acdc
, the encryption function compares acdc
characters by the first array to get true index's (if need) and then replace by second array index and change it to caea
.
how actually can I do that?