/** * Combine tags */ public static function combineTags($tag1, $tag2) { // Return if tags are the same if ($tag1 == $tag2) { return $tag1; } if (!preg_match('#<([a-z][a-z0-9]*)#si', $tag1, $tag_type)) { return $tag2; } $tag_type = $tag_type[1]; if (!($attribs = nnText::combineAttributes($tag1, $tag2))) { return '<' . $tag_type . '>'; } return '<' . $tag_type . ' ' . $attribs . '>'; }