Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:07:30+00:00 2026-05-30T07:07:30+00:00

How do I properly make an array like this one to be unique ?

  • 0

How do I properly make an array like this one to be unique ? (and by unique I mean that only the array[3] is removed as it’s a duplicate of array[2])

array(
 array( "Title", 50, 96 ),
 array( "Other Title", 110, 225 ),
 array( "Title", 110, 225 ),
 array( "Title", 110, 225 ),
)

The only array I want in this case to be filtered out is the last one (in this case), but there is no particular order, and manual labour isn’t going to cut it. (popping a targeted position). It is a rather large array, I have to think about performance here as well.

I could also arrange the data to be something like this:

array(
 array( "Title" => array( 50, 96 ), array(110, 225) )
 array( "Other Title", array( 110, 225 ) )
)

But that doesn’t help my cause this time.

There is no unique value in the array (alone), but the value combination for each second level array is unique.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:07:31+00:00Added an answer on May 30, 2026 at 7:07 am
    $array = array(array("Title", 50, 96), array("Other Title", 110, 225), array("Title", 110, 225), array("Title", 110, 225));
    
    function remove_duplicates_multi_array($array) {
    
        $serialized_arrays = array();
        // serialize every array
        foreach ($array as $key=>$value) {
            $serialized_arrays[$key] = serialize($value);
        }
        // use array_unique to remove duplicates
        $unique_array = array_unique($serialized_arrays);
    
        $multi_unique = array();
    
        //unserialize every item inside the array
        foreach($unique_array as $key=>$value) {
            $multi_unique[$key] = unserialize($value);
        }
    
        return $multi_unique;
    }
    
    var_dump(remove_duplicates_multi_array($array));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All I need is a way to make a property of one class only
I have a list of recipes obtained from a database that looks like this:
How would one return a class computed CSS property/property array? Like, if I have
Short story: I can't make precompiled headers work properly with gcc -c option. Long
I am trying to make a form field for a datetime property that allows
How can I make this work? switch(property.PropertyType){ case typeof(Boolean): //doStuff break; case typeof(String): //doOtherStuff
I would like to make a query which needs to compare an property's property
I'm trying to make an Address control that has an IsReadOnly property, which will
I'm really sorry. This must seem like an incredibly stupid question, but unless I
I have an EDIT control created like this: hwndEDIT_5 = CreateWindowEx ( 0, EDIT,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.