I wrote this a very long time ago but I assume it hasn't changed since ;)
function number2ascii($input='', $base=10){
$length = strlen($input);
$dec = base_convert(255, 10, $base);
$chars = strlen($dec);
$output = '';
for($i=0; $i<$length; $i+=$chars){
$text = substr($input, $i, $chars);
$dec = base_convert($text, $base, 10);
$output .= chr($dec);
}
return $output;
}
function ascii2number($input='', $base=10){
$length = strlen($input);
$dec = base_convert(255, 10, $base);
$chars = strlen($dec);
$output = '';
for($i=0; $i<$length; $i++){
$dec = ord($input[$i]);
$number = base_convert($dec, 10, $base);
$number = str_pad($number, $chars, 0, STR_PAD_LEFT);
$output .= $number.' ';
}
return $output;
}