Posted By

Unreal on 02/28/09


Tagged

text links to urls static


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

fox
BrianCoyDesign


Turn Static URLs Into Links


 / Published in: PHP
 

URL: http://www.imben.co.uk

Nice simple snippet. Great for forum scripts.

  1. function linkify($url){
  2. $string = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" target=\"_blank\">\\0</a>", $url);
  3. return $string;
  4. }

Report this snippet  

You need to login to post a comment.