Somebody asked me to make links of strings like http://somewhere.com in
my PHP page. Here's my first stab at it:
function linkify ($text) {
return preg_replace ("/(http:\/\/.*\b)/",
"<a href=\"$1\">$1</a>",
preg_replace ("/(ftp:\/\/.*\b)/",
"<a href=\"$1\">$1</a>",
$text));
} // linkify
However this fails in some cases (like when you have
http://somewhere.com, with a "," in a natural sentence). Plus the above
only handles http and ftp style builds. Rather than reinventing the
wheel as it were I was wondering if anybody had a better, more
generalized routine...
--
Why are they called stairs inside but steps outside?