note 58703 deleted from function.str-rot13 by nlopess
| From: | nlopess@php.net | Date: | Fri, 17 Mar 2006 17:32:42 +0000 |
| Subject: | note 58703 deleted from function.str-rot13 by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105993@lists.php.net to get a copy of this message | ||
Note Submitter: none at none dot com
----
Own function rot 13:
function rot13($txt)
{
$char = range('a', 'z');
$flip = array_flip($char);
for( $i = 0; $i < strlen($txt); $i++ )
{
if ( !in_array($txt[$i], $char) )
{
$out .= $txt[$i];
}
else
{
$tmp = $flip[$txt[$i]];
if ( $tmp <= 12 )
$tmp = $tmp + 13;
else
$tmp = $tmp - 13;
$out .= $char[$tmp];
}
}
return $out;
}