Array deduplication is difficult to calculate. there is an array that needs to be deduplicated. the format of the array is discussed online.
Reply to discussion (solution)
Paste the sample array output by var_export. the basis for not discussing is not discussed.
In fact, it is very simple. you only need to press the cluster key to cluster.
Paste the sample array output by var_export. the basis for not discussing is not discussed.
In fact, it is very simple. you only need to press the cluster key to cluster.
This is the current array.
Expected format:
Could you tell me how to format it like this?
Why? Do I have to type them one by one?
What are the requirements? If it is simply implemented, can it be a loop?
Array ('id' => 0, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather and heat tolerance '), 1 => array ('id' => 1, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather, heat proof '), 2 => array ('id' => 2, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather, heat proof '), 3 => array ('id' => 3, 'Send _ mobile' => '000000', 'c _ content' => 'weather heat ')); $ arrb = array (); foreach ($ arra as $ v) {$ B = $ v ['c _ content']; if (isset ($ arrb [$ B]) $ arrb [$ B] ['send _ mobile'] . = ','. $ V ['send _ mobile']; $ arrb [$ B] = isset ($ arrb [$ B])? $ Arrb [$ B]: $ v ;}$ arrb = array_values ($ arrb); print_r ($ arrb);?>
Let's see if you use c_id for differentiation. Then, use cid for key directly. $ arr [$ cid] [] = $ val
I suggest you use Chinese as an array key.
Foreach ($ arra as $ k =>v v) {$ res [$ v [c_content] = $ v ;}
One sentence OK
Create an array B and traverse original array a. if c_content in the traversal item does not appear in column B as the key name, insert B [c_content]; otherwise, add send_mobile to the traversal, and sort the entire ReKey value of array B.
Array ('id' => 0, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather and heat tolerance '), 1 => array ('id' => 1, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather, heat proof '), 2 => array ('id' => 2, 'Send _ mobile' => '000000', 'c _ content' => 'Hot weather, heat proof '), 3 => array ('id' => 3, 'Send _ mobile' => '000000', 'c _ content' => 'weather heat ')); $ arrb = array (); foreach ($ arra as $ v) {$ B = $ v ['c _ content']; if (isset ($ arrb [$ B]) $ arrb [$ B] ['send _ mobile'] . = ','. $ V ['send _ mobile']; $ arrb [$ B] = isset ($ arrb [$ B])? $ Arrb [$ B]: $ v ;}$ arrb = array_values ($ arrb); print_r ($ arrb);?>
Thank you for solving this problem.