RE: [PHP-DEV] rot13?

From: Date: Fri, 16 Jun 2000 16:18:43 +0000
Subject: RE: [PHP-DEV] rot13?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-21539@lists.php.net to get a copy of this message
What I mean though is adding a builtin function to php to do it... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Theodore Baschak - Gecko Internet Services http://www.gecko-internet.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@php.net] Sent: June 12, 2000 2:04 AM To: Theodore Baschak Cc: Php-Dev@Lists. Php. Net Subject: Re: [PHP-DEV] rot13? Actually, you can do this with a one-liner: strtr($text,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ","nopqrstu vwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"); Ok, so it is a rather long line... On Mon, 12 Jun 2000, Theodore Baschak wrote: > Theres no rot13 code in php that I know of.. but its raelly easy to write.. > maybe someone could re-write this in C and put it in sometime? > > <?php > function rot13($text) { > for ($i=0,$len=strlen($text);$i<$len;$i++) { > if > (strstr('abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ',$text[$i])) { > $text[$i] = chr(ord($text[$i]) + > ((strtoupper($text[$i]) > 'M') ? -13 : 13)); > } > } > return $text; > } > ?> > > Theodore > > > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#21539) next »