----- Original Message ----- 
From: "rkw1956" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 07, 2007 10:51 PM
Subject: [php-list] Re: Converting characters to ascii


Sorry my last post was a bit vague.

I believe I need to split up the individual characters within the
email address held in the $email variable before I can use regex to
convert the characters to ascii.

Any help with this aspect would be appreciated!

Richard
-------------------------
Hi,
    I have a windows desktop application that does this. Write to me offlist 
and I will send it to you.

As for doing it in php - try something like this -

$email = "[EMAIL PROTECTED]";

function to_ascii($string)
  {
    $length = strlen($string);
    for($pos = 0, $pos < $length, $pos++)
    {
    $onechr = substr($string, $pos, 1);
    $ascii = "&#" . ord($onechr) . ";";
    $output .= $ascii;
    }
  return $output;
  }

$tag = '<a href="' . to_ascii("mailto:"; . $email) . '">' . to_ascii($email) 
. "</a>";
echo($tag);





Reply via email to