- var_dump: documentation ( source)
- preg_replace: documentation ( source)
<?php
function autoLink($str) {
return preg_replace('/((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/iu', '<a href="$1" target="_blank">$1</a>', $str);
}
var_dump(autoLink('to jst link http://www.google.pl do gogle'));