我已經使用了以下問題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行的文本在DB
預期結果:
Array (
[happy] => 8
[beautiful] => 1
[lines] => 6
[pear] => 4
[gin] => 2
[rock] => 2)
那麼,你想添加數組在一起? –
是的,我確實有30000個陣列 – Rob