hexadecimal to ascii

Discussion in 'PHP' started by BAM78, Jan 18, 2010.

  1. #1
    is there a way to convert hexadecimal to ascii?

    in this format
    %68%69 which would be hi
     
    BAM78, Jan 18, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    Maybe this will help you

    
    function hextoascii($hex_str){
        $ascii_str = "";
        for($i=0; $i<strlen($hex_str); $i=$i+3){
            $ascii_str.=chr(hexdec(substr($hex_str, $i, 3)));
        }
        return $ascii_str;
    }
    
    echo(hextoascii("%68%69"));
    
    Code (markup):
     
    s_ruben, Jan 18, 2010 IP
  3. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Two seconds of googling hex to ascii converter and you can get one off the php.net site :rolleyes:
     
    JAY6390, Jan 18, 2010 IP