PHPFront

Home > PHP > highlight and shorten URLs
The PHP website created by its users!



highlight and shorten URLs


Author
Descriptionhighlight and shorten URLs with this simple function
RatingThis script has been rated 4/5 (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);
}
?>



Rate it: Print Print

Comments


Edgar / 20 Aug 05

What will this do.. like um... do you have a example?
RahXephon / 28 Dec 05

An example would be great you know.
Name
Website
Your comment