Posted By

sismevu on 02/10/10


Tagged

php link click


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

redstorm


Clickable link PHP


 / Published in: PHP
 

  1. protected function clickable_link($url,$chr_limit = 35,$add = '...')
  2. {
  3. 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);
  4. }

Report this snippet  

You need to login to post a comment.