Monday, 13 May 2013

"PHP Function For Truncate string and function For Truncate string"

/* Below function  For Truncate string */
    function truncate($text, $chars) {
    $add_dots='';
    if(strlen($text) > $chars){
        $add_dots = "...";
    }
    $text = str_replace('"','”',$text);
    $text = str_replace('"','“',$text);
    $text = str_replace("\n", "", $text);
    $text = str_replace("\r", "", $text);


    $text = $text." ";
    $text = substr($text,0,$chars);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text.$add_dots;
    return $text;
    }
    /*Function for refine tag and quotes in description. */
    function refineTagQuotes($text)
    {
        $text = str_replace('"','”',$text);
        $text = str_replace('"','“',$text);
        $text = str_replace("\n", "", $text);
        $text = str_replace("\r", "", $text);
        return $text;
    }

No comments:

Post a Comment

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...