Transform URL to hyperlinks

Submitted by:David Villa

Date added:19 September, 2011


If you leave a URL in the comment form of a WordPress blog, it will be automatically transformed into a hyperlink. If you want to implement the same functionality in your own website or web app, you can use the following code:

Tags: transform url

Code Snippet:

$url = "Jean-Baptiste Jung (";
$url = preg_replace("#http://([A-z0-9./-]+)#", '$0', $url);