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

  • SEARCH
  • Home
  • 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 8950053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:21:47+00:00 2026-06-15T13:21:47+00:00

Many languages have a Set data structure which typically only contain unique values from

  • 0

Many languages have a “Set” data structure which typically only contain unique values from a particular collection of objects. For instance, if you add the integers 1, 4, 5, 1, 2, and 6 to the set, in the end the set would actually only contain 1, 4, 5, 2 and 6.

I haven’t observed any kind of collection like this in PHP. Is there such a collection built into the language, or does something need to be custom rolled?

  • 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-06-15T13:21:49+00:00Added an answer on June 15, 2026 at 1:21 pm

    Doubt there is anything built in, but it’s very simple to achieve:

    <?
    
    $set = array(1, 4, 5, 1, 2, 6); // original set
    $set = array_unique($set);
    //$set = array_values($set); // add this to reset the keys
    print_r($set); // returns 1, 4, 5, 2 and 6.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of 50 items and many conditions that specificy which element
I have a question about the extraction of multiple values from a data.frame in
I have an n:n set of data (for example, 'programmers' and 'languages'. Programmers write
I've often heard the argument (in javascript, but many languages have an eval-like feature)
C++ has std::vector and Java has ArrayList , and many other languages have their
Many statically typed languages have parametric polymorphism. For example in C# one can define:
I want to translate text in Indian languages. I have gone through many articles
Structured programming languages typically have a few control structures, like while , if ,
I have a set of five boolean values. If more than one of these
I haven't used a statically typed language in many years and have set myself

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.