All pastes #93019 Raw Edit

Untitled

public php v1 · immutable
#93019 ·published 2006-07-20 03:36 UTC
rendered paste body
<?php//This function courtesy of Ludvig Ericson//ludvig.ericson@gmail.comif (!function_exists('str_split')) {   function str_split($string, $split_length = 1) {       return explode("\r\n", chunk_split($string, $split_length));   }}function rot($rotBy, $rotThis) {	if ($rotBy > 26 or $rotBy < 1) {		return "Number out of range";	}	if ($rotBy == 26) {		return $rotThis;	}	$rotThis = strtolower($rotThis);	$rotThisArray = str_split($rotThis);	for ($timesthrough = 0; $timesthrough <= each($rotThisArray);$timesthrough++) {		$asciiValue = ord($rotThisArray[$timesthrough]);		if (($asciiValue < 65) or (($asciiValue > 90) and ($asciiValue < 97)) or ($asciiValue > 122)) {			continue;		}		else {			$asciiValue = $asciiValue + $rotBy;						if ($asciiValue > 122) {				$wrapAdd = $asciiValue - 122;				$asciiValue = 96 + $wrapAdd;			}						$rotThisArray[$timesthrough] = chr($asciiValue);		}	}	$rotatedThis = implode($rotThisArray);	return $rotatedThis;}function rot_tbl($string) {	$i = 1;	while ($i < 27) {		echo $i.", ".rot($i, $string)."<br>";		$i = $i + 1;	}}if ($_GET['string'] == false) {	echo 	"Rot-X PHP Edition 1.5<br>		<form action=\"rot-x.php\" method=\"get\">			String to encode/decode: <INPUT type=\"text\" name=\"string\"><br>			<input type=\"submit\" name=\"Submit\"><br>		</form>";}else {	echo 	"Rot-X PHP Edition 1.5<br>";	$string = $_GET['string'];	echo	rot_tbl($string);}?>