Re: JavaScript conversion to PHP code...

From: Date: Mon, 26 Jul 2004 21:15:51 +0000
Subject: Re: JavaScript conversion to PHP code...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191915@lists.php.net to get a copy of this message
I think maybe this will do the trick.. --snip-- $char_code = strpos($char_set,(substr($input,$loop,1))); --snip-- FletchSOD "Scott Fletcher" <scott@abcoa.com> wrote in message news:20040726205131.14452.qmail@pb1.pair.com... > 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

« previous php.general (#191915) next »