note 12288 deleted from ref.strings by maxim
| From: | maxim@php.net | Date: | Tue, 12 Nov 2002 16:19:26 +0000 |
| Subject: | note 12288 deleted from ref.strings by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39395@lists.php.net to get a copy of this message | ||
Minor correction to my HTMLEncode function.
function HTMLEncode($text)
{
$searcharray = array(
"'([-_\w\d.]+@[-_\w\d.]+)'",
"'((?:(?!://).{3}|^.{0,2}))(www\.[-\d\w\.\/]+)'",
"'(http[s]?:\/\/[-_~\w\d\.\/]+)'");
$replacearray = array(
"<a href=\"mailto:\\1\">\\1</a>",
"\\1http://\\2",
"<a href=\"\\1\">\\1</a>");
return nl2br(preg_replace($searcharray, $replacearray, stripslashes($text) ));
}