JavaScript conversion to PHP code...
| From: | Scott Fletcher | Date: | Mon, 26 Jul 2004 20:51:05 +0000 |
| Subject: | JavaScript conversion to PHP code... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-191913@lists.php.net to get a copy of this message | ||
Hi, what is in your opinion is the best way to convert from JavaScript to
PHP.... What I'm not entirely sure of is the
"char_set.indexOf(input.charAt())"..... It look pretty tricky....
--snip--
var algorithm = 8;
for (loop=0; loop<input.length; loop++)
{
//search char_set string for character and set char_code variable...
char_code = char_set.indexOf(input.charAt(loop));
//opposite of encrypt algorithm goes here
if (char_code - algorithm < 0) {
space = algorithm - char_code;
char_code = char_set.length - space;
} else {
char_code -= algorithm;
}
//set output variable in accordance to char_set
output += char_set.charAt(char_code);
}
--snip--
Thanks,
FletchSOD