function link_sec($text)
if( strpos($text,"http://") )
{
$start = strpos($text,"http://");
$end = strpos(substr($text, strpos($text,"http://"), " ");
$link = strpos($text, $start, $end-$start);
return strpos($text,0,$start)."<a href=$link>".$link."</a>".strpos($text,$end);
}
return $text;
}gibi yapılabilir, dahada geliştirilebilir,
yukarıdaki fonksyonu incelerseniz fikir sahibi olabilirsiniz
EDIT: başka bir yöntem
<?php
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$text = "The text you want to filter goes here. http://google.com";
if(preg_match($reg_exUrl, $text, $url)) {
echo preg_replace($reg_exUrl, "<a href="{$url[0]}">{$url[0]}</a> ", $text);
} else
echo $text;
?>alıntı :
http://css-tricks.com/snippets/php/f...xt-make-links/