A method of calculating the difficulty of the array de-weight statistic problem
There is an array that needs to be re-reorganized in the format of the array online discussion
------to solve the idea----------------------
$arra = Array (
0 = Array (
' id ' = 0,
' Send_mobile ' = ' 13267310236 ',
' C_content ' and ' The weather is hot note heatstroke '
),
1 = Array (
' id ' = 1,
' Send_mobile ' = ' 13267310285 ',
' C_content ' and ' The weather is hot note heatstroke '
),
2 = Array (
' id ' = 2,
' Send_mobile ' = ' 13267310126 ',
' C_content ' and ' The weather is hot note heatstroke '
),
3 = Array (
' id ' = 3,
' Send_mobile ' = ' 13267310166 ',
' c_content ' = ' weather heatstroke '
)
);
$ARRB = Array ();
foreach ($arra as $v) {
$b = $v [' c_content '];
$ARRB [$b] [' send_mobile ']. = ', '. $v [' Send_mobile '];
$ARRB [$b] = Isset ($ARRB [$b])? $ARRB [$b]: $v;
}
$ARRB = Array_values ($ARRB);
Print_r ($ARRB);
?>
------to solve the idea----------------------
Look at you that is to use c_id to make a distinction, then directly with the CID to do key, $arr [$cid] = $val
------to solve the idea----------------------
Hint you Chinese can be used as an array key
foreach ($arra as $k = + $v) {$res [$v [c_content]] = $v;}
A word OK
------to solve the idea----------------------
Create a new array of B, traverse the original arrays A, if the c_content in the Traverse item does not appear in B as the key name, insert a b[c_content]; otherwise, add the Send_mobile to the loop, and then sort the entire re-key value of the B array.