tags:

views:

287

answers:

3

convert DEC to ASCII:

$ascii=chr($t);

I need a code that converts ASCII to DEC.

A: 

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;
}
jcinacio
A: 

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.

Gumbo