note 51184 added to function.ord

From: Date: Wed, 23 Mar 2005 01:08:55 +0000
Subject: note 51184 added to function.ord
Groups: php.notes 
Request: Send a blank email to php-notes+get-86819@lists.php.net to get a copy of this message
The email-encoding function, a little extended: # $strEmail. The E-mail address to encode. # $strDisplay. What will be displayed in the browser. If omitted it takes the e-mail address as it's value. # $blnCreateLink. Set to true to creates a link. Set to false (and omit $strDisplay) just displays the e-mail address. function asciiEncodeEmail($strEmail,$strDisplay,$blnCreateLink) { $strMailto = "&#109;&#097;&#105;&#108;&#116;&#111;&#058;"; for ($i=0; $i < strlen($strEmail); $i++) { $strEncodedEmail .= "&#".ord(substr($strEmail,$i)).";"; } if(strlen(trim($strDisplay))>0) { $strDisplay = $strDisplay; } else { $strDisplay = $strEncodedEmail; } if($blnCreateLink) { return "<a href=\"".$strMailto.$strEncodedEmail."\">".$strDisplay."</a>"; } else { return $strDisplay; } } #examples: echo asciiEncodeEmail("yourname@yourdomain.com","Your Name",true); echo "<br />" echo asciiEncodeEmail("yourname@yourdomain.com","",true); echo "<br />" echo asciiEncodeEmail("yourname@yourdomain.com","",false); ---- Manual Page -- http://www.php.net/manual/en/function.ord.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51184 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51184&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51184&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51184&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51184&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51184&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51184&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86819) next »