$str = " Shei
Bidandan
Machali
Li Xin
Li Ping ";
There is a string of strings that are processed by PHP to get a new array (name, count value);
For example, generate $ars =array (' 0 ' = ' Shei ', ' 0 ' = ' Bidandan ', ' 0 ' = ' Machali ', ' 0 ' + ' li Xin ', ' 1 ' = ' li ping ');
Please help the heroes, thank you.
Reply to discussion (solution)
$str = "
Shei
Bidandan
Machali
Li Xin
Li
ping
";p reg_match_all ("/
(. *?) <\/v:note>/", $str, $matches); $newArr = Array_combine ($matches [2], $matches [1]); Var_dump ($NEWARR);? >
It is not possible to have the same key value in the PHP array, so the key value can only be guaranteed by name.
It's impossible to generate the kind you want. The same key cannot be present at the same time. The latter will cover the former.
Only Array (' 0 ' = ' Shei ', ' 1 ' = ' Bidandan ', ' 2 ' = ' Machali ', ' 3 ' + ' Li Xin ', ' 4 ' = ' li ping '); Like this.
Your count can't be a key.
$str = "
Shei
Bidandan
Machali
Li Xin
Li
ping
";p reg_match_all ("/
(. *?) <\/v:note>/", $str, $matches); $newArr = Array_combine ($matches [2], $matches [1]); Var_dump ($NEWARR);? >
It is not possible to have the same key value in a PHP array, so you can only use the name to make a key value to ensure that the only result is a string array (5) {
["Shei"]=>
String (1) "0"
["Bidandan"]=>
String (1) "0"
["Machali"]=>
String (1) "0"
["Li Xin"]=>
String (1) "0"
["Li Ping"]=>
String (1) "1"
}
Can this string be removed?
It's impossible to generate the kind you want. The same key cannot be present at the same time. The latter will cover the former.
Only Array (' 0 ' = ' Shei ', ' 1 ' = ' Bidandan ', ' 2 ' = ' Machali ', ' 3 ' + ' Li Xin ', ' 4 ' = ' li ping '); Like this.
Your count can't do the key, I just have to sort the header by the value inside count
The string where there is no string is the output from anywhere else.
The string where there is no string is the output from anywhere else. Thank you for your points.