Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $frequency = array();
- foreach($words[0] as $word) {
- unset($words[$word]);
- // This is the filter out the 'common words'
- if(in_array($word, $common_words)) continue;
- if(isset($frequency[$word])) {
- $frequency[$word] += 1;
- } else {
- $frequency[$word] = 1;
- }
- }
- $total_words = array_count_values(str_word_count('your_string', 1));
- print_r($total_words);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement