如何获取对应数组的结果。形成新的对应数组
//第一步<br> $t1 = Array ( 0 => '南昌', 1 => '南昌', 2 => '赣州', 3 => '九江', 4 => '赣州', 5 => '九江'); <br> $t2 = Array ( 0 => '优秀', 1 => '良好', 2 => '优秀', 3 => '良好', 4 => '优秀', 5 => '差等' );<br> $t = array_map(null, $t1, $t2);<br> print_r($t);<br> /* 得到<br> Array<br> (<br> [0] => Array<br> (<br> [0] => 南昌<br> [1] => 优秀<br> )<br> <br> [1] => Array<br> (<br> [0] => 南昌<br> [1] => 良好<br> )<br> <br> [2] => Array<br> (<br> [0] => 赣州<br> [1] => 优秀<br> )<br> <br> [3] => Array<br> (<br> [0] => 九江<br> [1] => 良好<br> )<br> <br> [4] => Array<br> (<br> [0] => 赣州<br> [1] => 优秀<br> )<br> <br> [5] => Array<br> (<br> [0] => 九江<br> [1] => 差等<br> )<br> )<br> */<br> <br> //第二步<br> $r = array();<br> foreach($t as $v) {<br> $r[$v[0]][] = $v[1];<br> }<br> print_r($r);<br> /*得到<br> Array<br> (<br> [南昌] => Array<br> (<br> [0] => 优秀<br> [1] => 良好<br> )<br> <br> [赣州] => Array<br> (<br> [0] => 优秀<br> [1] => 优秀<br> )<br> <br> [九江] => Array<br> (<br> [0] => 良好<br> [1] => 差等<br> )<br> )<br> */<br> <br> //第三步<br> $r = array_map('array_count_values', $r); <div class="clear"> </div>