Posted By

jrobinsonc on 04/05/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

dantreacy


Convert URLs within String into hyperlinks


 / Published in: PHP
 

This function converts URLs and e-mail addresses within a string into clickable hyperlinks.

  1. $url = "Jose Robinson Blog http://www.joserobinson.com/blog";
  2. $url = preg_replace("#https?://[A-z0-9\./-_+&\#@:%~=]+#", '<a href="$0">$0</a>', $url);

Report this snippet  

You need to login to post a comment.