simple encryption example. output is the sum of 2 and the ascii value of each character.
for example, below is listed a string of characters and their ascii value.
s = 115, e = 101, a = 97, n = 110
this snippet will take the ascii value and add 2 to it. the output would be ( within an array ):
s = 117, e = 103, a = 99, n = 112
finially, the snippet implode()'s the output into a string separated by character 46 ('.'). you can change the operation ('+') and the key ('2') to your desire for security and functionality purposes.
Usage:
printf('encrypted: %s<br />decrypted: %s', _enc($s), _dec(_enc($s)));
function _enc($s)
{
for( $i = 0; $i < strlen($s); $i++ )
$r[] = ord($s[$i]) + 2;
return implode('.', $r);
}
function _dec($s)
{
$s = explode(".", $s);
for( $i = 0; $i < count($s); $i++ )
$s[$i] = chr($s[$i] - 2);
return implode('', $s);
}
Or you could use XAMPP or Apache2Triad to get Apache/PHP/mySQL running on Windows in just a few minutes.