function hasRawText($text) { // checks whether the text has text not already enclosed by a block tag $r = trim(preg_replace('@<(p|blockquote|div|form|table|ul|ol|pre|h\d)[^>]*?>.*@s', '', trim($text))); $r = trim(preg_replace('@<(hr|br)[^>]*?/>@', '', $r)); return '' != $r; }