/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function parseURLs($str, $length = 15){
if($matches){
foreach($matches[0] as $url){
$text = $length ? shortText($url,$length) : $url;
$replace = '<a href="'.$url.'">'.$text.'</a>';
}
}
return $str;
}
function shortText($text, $chars){
$str = $text;
$str .= "...";
return $str;
}else {
return $str;
}
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                