so hab das ganze in php doch noch hingekriegt:
PHP-Code:
<?php
function plain2caesar($input, $diff)
{
$tmp = strtoupper($input);
$signs = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$anzahl = count($signs);
for ($x = 0; $x < $anzahl ; $x++)
{
if ( ($x-$anzahl+$diff) >= 0 )
{
$signs2[$signs{$x}] = $signs[$x-$anzahl+$diff];
}
else
{
$signs2[$signs{$x}] = $signs[$x+$diff];
}
}
print_r($signs2);
$strRet = "";
for($i = 0; $i < strlen($tmp); $i++)
{
if (in_array($tmp{$i}, $signs2))
{
$strRet .= $signs2[$tmp{$i}];
}
else
{
$strRet .= $tmp{$i};
}
}
return $strRet;
}
?>
mfg