我使用了以下问题php: sort and count instances of words in a given string
我的数据库中有一个带有文本字段的表,并且想对该字段中的单词进行一些分析,但我需要合并结果
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
我现在有一个看起来像这样的数组(但它的每行)
第 1 行
Array (
[happy] => 4
[beautiful] => 1
[lines] => 3
[pear] => 2
[gin] => 1
[rock] => 1 )
第 2 行
Array (
[happy] => 4
[lines] => 3
[pear] => 2
[gin] => 1
[rock] => 1 )
如何对所有行执行此操作以组合结果 - 数据库中有 30000 行文本
预期成绩:
Array (
[happy] => 8
[beautiful] => 1
[lines] => 6
[pear] => 4
[gin] => 2
[rock] => 2 )