Bobafart
01-24-2008, 01:22 AM
I need some array manipulation help.
I have two arrays ($array_headlineKeywords and $array_bodyKeywords), for example:
Array ( [0] => [1] => yahoo [2] => eyeing [3] => online [4] => music [5] => service [6] => )
Array ( [0] => [1] => yahoo [2] => discussions [3] => major [4] => record [5] => labels [6] => offering [7] => unprotected [8] => mp3s [9] => sale [10] => free [11] => part [12] => ad-supported [13] => service [14] => record [15] => company [16] => executives [17] => familiar [18] => talks [19] => wednesday [20] => )
I want to combine both arrays into 1 array (say $array_headlinebodyKeywords)
and then count the frequency of each word (I assume array_count_values can do that)
and then arrange each element in the array in the order of greatest frequency to least frequency
and then only keep the first 5 elements in the array (which are the most frequently appearing words in the array)
---
anyone know how to do this?
I have two arrays ($array_headlineKeywords and $array_bodyKeywords), for example:
Array ( [0] => [1] => yahoo [2] => eyeing [3] => online [4] => music [5] => service [6] => )
Array ( [0] => [1] => yahoo [2] => discussions [3] => major [4] => record [5] => labels [6] => offering [7] => unprotected [8] => mp3s [9] => sale [10] => free [11] => part [12] => ad-supported [13] => service [14] => record [15] => company [16] => executives [17] => familiar [18] => talks [19] => wednesday [20] => )
I want to combine both arrays into 1 array (say $array_headlinebodyKeywords)
and then count the frequency of each word (I assume array_count_values can do that)
and then arrange each element in the array in the order of greatest frequency to least frequency
and then only keep the first 5 elements in the array (which are the most frequently appearing words in the array)
---
anyone know how to do this?