SHARE
TWEET

mb_str_word_count

selnomeria Nov 28th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         if (!function_exists('mb_str_word_count')) {  
  2.             function mb_str_word_count($string, $format = 0, $charlist = '[]') {
  3.                 $string=trim($string);
  4.                 if(empty($string)){$words = array();}    else {$words = preg_split('~[^\p{L}\p{N}\']+~u',$string);}
  5.                 switch ($format) {   case 0: return count($words); break;       case 1:      case 2: return $words; break;          default: return $words; break;    }
  6.             }
  7.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top