How to turn a URL into a hyperlink

Last update on August 2, 2009 12:50 PM by jak58
Published by jak58

How to turn a URL into a hyperlink







If you are using PHP, there is a simple way to turn a URL into a hyperlink when inserting the address into your PHP document. This process is mostly used to ease the users' search of external websites or pages; there are no copy and paste issues that he will have to face to be able to visit the desired page. It also saves much time and will make your webpage more user friendly.

You can copy and paste the link below in your PHP document:

<?
$message = eregi_replace("((([ftp://])|(http(s?)://))((:alnum:|[-\%\.\?\=\#\_\:\&\/\~\+\@\,\;])*))","<a href = '\\0' target='_blank'>\\0</a>",$message);

$message = eregi_replace("(([^/])www\.|(^www\.))((:alnum:|[-\%\.\?\=\#\_\:\&\/\~\+\@\,\;])*)","\\2<a href = 'http://www.\\4' target='_blank'>www.\\4</a>",$message);
?>
Best answers for « How to turn a URL into a hyperlink » in :
Converting a URL to a clickable hyperlink Show Converting a URL to a clickable hyperlink With regular expressions, it is possible to transform any hyperlink URL of the form http://URL (or ftp://URL) or beginning with www. :
PHP 5 - Using an external URL with the function include ShowPHP 5 - Using an external URL with the function include The option to include an external URL (ie absolute, in the form http://site.tld/url) with the function include is disabled by default from PHP 5 and latest version. Below is the two...
Favicon]having the icon of your site in the address bar Show[Favicon]having the icon of your site in the address bar To create an animated favicon or generate an ICO file Putting favicon online Notes You have probably noticed the presence of an icon to the left of the URL into the address...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Download Slideshow Movie Producer ShowHave you many digital photos? Would you like to turn them into a movie with effects and background music? Slideshow Movie Producer should be useful to you. With your image, it allows you to create movies and even full-length movies which have the...
URL ShowWhat is a URL? A URL (Uniform Resource Locator) is a universal naming format used to indicate a resource on the Internet. It is a printable ASCII character string which breaks down into five parts: The name of the protocol: i.e. in a way the...
URL manipulation attacks ShowIntroduction to URLs The URL (Uniform Resource Locator) of a web application is the vector that makes it possible to indicate the requested resource. It is a string of printable ASCII characters that is divided into five parts: The name of the...