How to turn a URL into a hyperlink

Ask a question





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);
?>

phpize: command not found
PhpMyAdmin - Access denied for user root@localhost