/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected function clickable_link($url,$chr_limit = 35,$add = '...') { return preg_replace("!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e", "'<a href=\"\\1\" title=\"\\1\" target=\"_blank\">'.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').'</a>'", $url); }