Count Characters, but Not HTML or Links

I took a lazy Google look and didn’t see how to do this. If you want to use PHP to count characters in a string but only the visible text (in other words you don’t want to count the html— like links and whatnot), then just use this function. It returns the string length.

function visible_count($str){
echo strlen(strip_tags($str));

Of if you want to reject a string that is too long, try the below. It returns true if the string is within a limit, false if it exceeds the limit. Modify at as needed.

function the_limit($str,$max){
if($counter>$max) return true:return false;