convert DEC to ASCII:
$ascii=chr($t);
I need a code that converts ASCII to DEC.
convert DEC to ASCII:
$ascii=chr($t);
I need a code that converts ASCII to DEC.
not sure what kind of input/ouput you should have, but probably something like this:
function ascii_to_dec($str)
{
for ($i = 0, $j = strlen($str); $i < $j; $i++) {
$dec_array[] = ord($str{$i});
}
return $dec_array;
}
The ord
function converts a single byte to its integer value (0 ≥ i ≥ 255) and not just the 128 characters of the ASCII character set.