|
Posted by Erwin Moller on 08/04/06 08:51
kuukelekuu@gmail.com wrote:
> I need to convert ascii chars to hex chars.
>
> I searched the internet, found hex to ascii, but nowhere is there a
> ascii to hex method created by anyone.
>
> Can anyone help me with that?
>
> Chears
Hi,
You question is a bit confusing. :-)
hex is nothing more than a 16-base notation.
ascii is definition to declare the first 128 values of a byte to characters
(or more depending on which one you pick).
So that are two different animals.
In PHP:
int -> ascii char : chr()
http://nl2.php.net/manual/en/function.chr.php
ascii -> int : ord()
http://nl2.php.net/manual/en/function.ord.php
Note that the int is 10-base, so you'll have to transform it into hex by
using dexhex() and hexdec() depending on the direction. :-)
Also, this may be of use:
http://www.lookuptables.com/
Hope that helps you going.
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|