title: str_word_count() function doesn't display Arabic language properly
body: <p>I've made the next function to return a specific number of words from a text:</p>
  
  <pre><code>function brief_text($text, $num_words = 50) {
      $words = str_word_count($text, 1);
      $required_words = array_slice($words, 0, $num_words);
      return implode(" ", $required_words);
  }
  </code></pre>
  
  <p>and it works pretty well with English language but when I try to use it with Arabic language it fails and doesn't return words as expected. For example:</p>
  
  <pre><code>$text_en = "Cairo is the capital of Egypt and Paris is the capital of France";
  echo brief_text($text_en, 10);
  </code></pre>
  
  <p>will output <strong><code>Cairo is the capital of Egypt and Paris is the</code></strong> while</p>
  
  <pre><code>$text_ar = "القاهرة هى عاصمة مصر وباريس هى عاصمة فرنسا";
  echo brief_text($text_ar, 10); 
  </code></pre>
  
  <p>will output <code>� � � � � � � � � �</code>.</p>
  
  <p>I know that the problem is with the <code>str_word_count</code> function but I don't know how to fix it.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have already written another function that works pretty good with both English and Arabic languages,  but I was looking for a solution for the problem caused by <code>str_word_count()</code> function when using with Arabic. Anyway here is my other function:</p>
  
  <pre><code>    function brief_text($string, $number_of_required_words = 50) {
          $string = trim(preg_replace('/\s+/', ' ', $string));
          $words = explode(" ", $string);
          $required_words = array_slice($words, 0, $number_of_required_words); // get sepecific number of elements from the array
          return implode(" ", $required_words);
      }
  </code></pre>