this came in usefull for me so il thought i would ad it here
	$longurl is the long url that you want shortened.
$shorturl is calling the function to shorten the url down to 45 characters.
					Code:
	
	<?php
function shortenurl($url){
    $length = strlen($url);
    if($length > 45){
        $length = $length - 30;
        $first = substr($url, 0, -$length);
        $last = substr($url, -15);
        $newurl = $first."[ ... ]".$last;
        return $newurl;
    }else{
        return $url;
    }
}
$longurl = "http://www.google.com/search?hl=en&client=firefox-a&channel=s&rls=org.mozilla%3Aen-US%3Aofficial&hs=BCR&q=metacafe&btnG=Search";
$shorturl = shortenurl($longurl);
echo"<a href=\"$longurl\">$shorturl</a>";
?>
$shorturl is calling the function to shorten the url down to 45 characters.
							
						
   Thanks master
Comment