I have used the following question php: sort and count instances of words in a given string
I have a table in my DB with a text field and want to do some analysis of the words in that field, but I need to combine the results
ID | Text Field
1 | happy beautiful happy lines pear gin happy lines rock happy lines pear
2 | happy lines pear gin happy lines rock happy lines pear
I now have an array that looks like this (but its per row)
Row 1
Array (
[happy] => 4
[beautiful] => 1
[lines] => 3
[pear] => 2
[gin] => 1
[rock] => 1 )
Row 2
Array (
[happy] => 4
[lines] => 3
[pear] => 2
[gin] => 1
[rock] => 1 )
How can I do this for all the rows to combine the results - There are 30000 rows of text in the DB
Expected Results:
Array (
[happy] => 8
[beautiful] => 1
[lines] => 6
[pear] => 4
[gin] => 2
[rock] => 2 )