There are table tbl_contents; field tag, content such as
"C++,php,css"
"Nginx,php,api"
The good way to extract these tags and count the number of occurrences to the array (PHP implementation) results are as follows
Array ("C + +" =>1, "PHP" =>2, "Nginx" =>1, "CSS" =>1, "API" =>1);
Except for the dumb way of querying the array in a split loop. Thank you
Reply content:
There are table tbl_contents; field tag, content such as
"C++,php,css"
"Nginx,php,api"
The good way to extract these tags and count the number of occurrences to the array (PHP implementation) results are as follows
Array ("C + +" =>1, "PHP" =>2, "Nginx" =>1, "CSS" =>1, "API" =>1);
Except for the dumb way of querying the array in a split loop. Thank you
$a 1 = array (' C + + ', ' php ', ' CSS '), $a 2 = array (' Nginx ', ' php ', ' API '); $merged = Array_merge ($a 1, $a 2); $result = Array_count_values ($merged); Echo '
';p rint_r ($result); exit;
Output:
Array ([C + +] + 1 [PHP] + 2 [CSS] + 1 [Nginx] = 1 [API] + 1)
Halo, turn off the problem for Mao. Maybe there is a better way to deal with the LZ Big data Ah ... Really no words