strip_html( $text ); if ( '' === $text ) { return 0; } return count( preg_split( '/\s+/u', $text ) ); } /** * Strips HTML down to plain, whitespace-normalized text. * * Tags are replaced with a single space, not removed outright — removing * them outright (as bare strip_tags() does) glues adjacent block-level * text together with no separator, e.g. "...word.

Next..." becomes * "...word.Next..." with no space after the period, silently merging * text that should stay separated.