I think maybe this will do the trick..

--snip--
$char_code = strpos($char_set,(substr($input,$loop,1)));
--snip--

FletchSOD

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to