Ladies and gentlemen, read strings via php for help $ str =" Thank you!
Bi Dandan
Ma Chaoli
Li Xin
Li Ping ";
When such a string is processed using php, a new array (name, count value) is obtained );
For example, generate $ ars = array ('0' => 'Xie shares', '0' => 'bidandan ', '0' => 'ma Chaoli ', '0' => 'Li Xin', '1' => 'Li ping ');
Thank you for your help.
Reply to discussion (solution)
$ Str ="
Thank you!
Bi Dandan
Ma Chaoli
Li Xin
Li Ping
"; Preg_match_all ("/
(.*?) <\/V: note>/", $ str, $ matches); $ newArr = array_combine ($ matches [2], $ matches [1]); var_dump ($ newArr);?>
The php array does not have the same key value. Therefore, only names can be used as key values to ensure uniqueness.
It is impossible to generate the type you want. The same key cannot exist at the same time. The latter will overwrite the former.
Only array ('0' => 'Xie qing', '1' => 'bidand', '2' => 'ma Chaoli ', '3' => 'Li Xin', '4' => 'Li ping'); similar to this.
Your count cannot be a key.
$ Str ="
Thank you!
Bi Dandan
Ma Chaoli
Li Xin
Li Ping
"; Preg_match_all ("/
(.*?) <\/V: note>/", $ str, $ matches); $ newArr = array_combine ($ matches [2], $ matches [1]); var_dump ($ newArr);?>
The php array cannot have the same key value. Therefore, only the name can be used as the key value to ensure that the unique result contains a string array (5 ){
["Thank you"] =>
String (1) "0"
["Bi Dan"] =>
String (1) "0"
["Ma Chaoli"] =>
String (1) "0"
["Li Xin"] =>
String (1) "0"
["Li Ping"] =>
String (1) "1"
}
Can this string be removed?
It is impossible to generate the type you want. The same key cannot exist at the same time. The latter will overwrite the former.
Only array ('0' => 'Xie qing', '1' => 'bidand', '2' => 'ma Chaoli ', '3' => 'Li Xin', '4' => 'Li ping'); similar to this.
Your count cannot be used as the key. I only need to be able to sort by the value in the count header.
There is no string where the string is output elsewhere.
There is no string. the string is output elsewhere. thank you for your score.