Código PHP:
$text = "Esta url me lleva a http://www.google.com ";
$text = preg_replace("#http://[a-z0-9._/-]+#i", "<a href='$0'>$0</a>", $text);
$regex = "#[ ]+(www.([a-z0-9._-]+))#i";
$text = preg_replace($regex," <a href='http://$1'>$1</a>", $text);
Código PHP:
//aca hay un SELECT
while($fila = $slc->fetch()) {
$text = utf8_encode($fila["texto"]);
$text = preg_replace("#http://[a-z0-9._/-]+#i", "<a href='$0'>$0</a>", $text);
$regex = "#[ ]+(www.([a-z0-9._-]+))#i";
$text = preg_replace($regex," <a href='http://$1'>$1</a>",$text);
Código HTML:
Mensaje: <?=$text;?>