toby: url als link

Beitrag lesen

probier das mal:

function parseHyper($string)
  {
   $search = array ( "/([\w./&=?-]+)@([\w./&=?-]+)/",
        "/((ftp(7?)://)|(ftp.))([\w./&=?-]+)/",
        "/((http(s?)://)|(www.))([\w./&=?-]+)/"
       );
   $replace = array ( "<a href="mailto:$1@$2">$1@$2</a>",
        "<a href="ftp$3://$4$5" target="_blank">$4$5</a>",
        "<a href="http$3://$4$5" target="_blank">$4$5</a>");

return preg_replace ($search, $replace, $string);
  }