<?php
$str = 'Hi bro! Look at my new website: www.example.com. I leard to build websites from http://another.example.net and from example.net.';
$newStr = preg_replace('!(http|ftp|scp)(s)?:\/\/[a-zA-Z0-9.?&_/]+!', "<a href=\"\\0\">\\0</a>",$str);
echo $newStr;
Hi bro! Look at my new website: www.example.com. I leard to build websites from <a href="http://another.example.net">http://another.example.net</a> and from example.net.