|
highlight and shorten URLs
| Author | |
| Description | highlight and shorten URLs with this simple function |
| Rating | (3 votes) |
PHP Code
<?php
function n3y_url_shorten($url,$chr_limit = 30,$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);
}
?>
Comments
What will this do.. like um... do you have a example?
An example would be great you know.
|