Posted By

jrobinsonc on 04/05/10


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


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";
  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.