Amendment to String Problem
| From: | Chris Payne | Date: | Thu, 10 Apr 2003 02:56:48 +0000 |
| Subject: | Amendment to String Problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26972@lists.php.net to get a copy of this message | ||
Hi there Everyone,
Here's a better example of the problem i'm having, there is probably a MUCH better way to
do this, but here goes.
I am using the following code:
$passroutine = 'abcdefghijklmnopqrstuvwxyz';
$passroutine = str_replace("a", "z", $passroutine);
$passroutine = str_replace("b", "y", $passroutine);
$passroutine = str_replace("c", "x", $passroutine);
$passroutine = str_replace("d", "w", $passroutine);
$passroutine = str_replace("e", "v", $passroutine);
$passroutine = str_replace("f", "u", $passroutine);
$passroutine = str_replace("g", "t", $passroutine);
$passroutine = str_replace("h", "s", $passroutine);
$passroutine = str_replace("i", "r", $passroutine);
$passroutine = str_replace("j", "q", $passroutine);
$passroutine = str_replace("k", "p", $passroutine);
$passroutine = str_replace("l", "o", $passroutine);
$passroutine = str_replace("m", "n", $passroutine);
$passroutine = str_replace("n", "m", $passroutine);
$passroutine = str_replace("o", "l", $passroutine);
$passroutine = str_replace("p", "k", $passroutine);
$passroutine = str_replace("q", "j", $passroutine);
$passroutine = str_replace("r", "i", $passroutine);
$passroutine = str_replace("s", "h", $passroutine);
$passroutine = str_replace("t", "g", $passroutine);
$passroutine = str_replace("u", "f", $passroutine);
$passroutine = str_replace("v", "e", $passroutine);
$passroutine = str_replace("w", "d", $passroutine);
$passroutine = str_replace("x", "c", $passroutine);
$passroutine = str_replace("y", "b", $passroutine);
$passroutine = str_replace("z", "a", $passroutine);
which is SUPPOSED to replace letters, a because z and so on, but after it gets to m it screws up and
displays:
abcdefghijklmmlkjihgfedcba
How can I do the above code in such a way that it won't produce this problem?
Any help will be greatly appreciated :-)
Regards
Chris