Version: 1.0
Type: Function
Category: HTML
License: GNU General Public License
Description: This function searches text for URL's and changes them into hyperlinks (http://phpbuilder.com becomes <a href=http://www.phpbuilder.com>http://www.phpbuilder.com</a>. It's especially useful for times when you don't wish to let your visitors use html in forums or other such public areas.
<?PHP
/* makehref(string string,string more);
the more will put what you want i think in a bug but i solve it.. the space in the end that i put.. if you want can create a better regular expression. i dont want to use my mind now.
*/
function makehref($s,$more) {
return preg_replace("/ $/","",preg_replace("/(http:\/\/[\w\s\/\.-_]*?)([ <\n])/",'\\1\\2',$s . ' '));
}
makehref("this is only a http://www.teste.com and this\nis another http://true.test.com, but this is a test in http://same.line.com hehe");
?>