Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $frequency = array();
  2.  
  3. foreach($words[0] as $word) {
  4.  
  5. unset($words[$word]);
  6.  
  7. // This is the filter out the 'common words'
  8. if(in_array($word, $common_words)) continue;
  9.  
  10. if(isset($frequency[$word])) {
  11. $frequency[$word] += 1;
  12. } else {
  13. $frequency[$word] = 1;
  14. }
  15. }
  16.  
  17. $total_words = array_count_values(str_word_count('your_string', 1));
  18. print_r($total_words);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement