Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

PHP/Javascript Problem

Javascript coding ..

Moderators: macek, egami, gesf

Postby ruturajv » Sat Dec 04, 2004 3:15 am

here is some func in PHP posted
Code: Select all
 joh at n dot liesen dot se
26-Nov-2004 10:05
It's also possible to rot13 a string without using a lookup table.

<?php
function rot13($s)
{
   $rot13  = "";
 
   for ($i = 0; $i < strlen($s); ++$i)
   {
     $char = ord($s{$i});
     $cap = $char & 32;
   
     $char &= ~$cap;
     $char = (($char >= ord('A')) && ($char <= ord('z'))) ? (($char - ord('A') + 13) % 26 + ord('A')) : $char;
     $char |= $cap;
   
     $rot13 .= chr($char);
   }
 
   return $rot13;
}
?>


You can definately do the above in JavaScript
I hope you have the Javascript 1.3 reference Manual, Because Devedge.netscape.com is down since more than a month now... Mozilla guys seem to recover it.
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.