How do I remove duplicates in a two-dimensional array?

Source: Internet
Author: User
How do I remove duplicates in a two-dimensional array?
I have a array,var_dump. The value is:
Array (1) {[0]=> Array (3) {[0]=> string (0) "" [1]=> string (4) "Ancient Shepherd" [2]=> string (0) ""}}
Now to add a new value to this array: $info [] = $insert;
After the addition, I want to get rid of the duplicate items I don't want the same item to have two
I use Array_unique ($info) No matter how to go heavy?
is if there is another item {"", "Ancient Shepherd", ""}

As long as one item or the other is added, judge

------Solution--------------------
PHP Code
function Array_multiunique ($ar) {  $t = Array_map (' serialize ', $ar);  $t = Array_unique ($t);  Return Array_map (' unserialize ', $t);}   $ar = Array ("  ", "Ancient Shepherd", ""),  Array ("", "" Ancient Shepherd "," "),);p Rint_r (Array_multiunique ($ar));
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.