How to short URL Function with PHP ?

Q

Useful PHP Code Snippets for Developers - How to short URL Function with PHP

✍: Guest

A
 45){
 $length = $length - 30;
 $first = substr($url, 0, -$length);
 $last = substr($url, -15);
 $new = $first."[ ... ]".$last;
 return $new;
 }else{
 return $url;
 }
}
?>
 
// USAGE
 
$shorturl";
 
?>

2015-06-19, 331👍, 0💬