Get text between HTML tags – PHP

function getTextBetweenHtmlTags($string, $tagname) {    $pattern = “/<$tagname>(.*?)</$tagname>/”;    preg_match($pattern, $string, $matches);    return $matches[1]; }function truncate_str($str, $maxlen) {    if (strlen($str) <= $maxlen) {       return $str;    }      $newstr =…

Continue Reading →

Posted in: PHP