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 928731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:03:32+00:00 2026-05-15T20:03:32+00:00

How do i check if a specific array key exist and how to compare

  • 0

How do i check if a specific array key exist and how to compare them?

1. Array looks like this.

[33] => Array
               (
                   [211] =>objectr
                       (
                           [name] => Test
                           [id]=>  211
                    )
               )

[23] => Array
               (
                   [311] =>objectr
                       (
                           [name] => Tester
                           [id]=>  311
                    )
               )

2. Array looks like this

   [0] => 311
   [1] => 211
   [2] => 99

Now i need to compare them and get the id of them.

What im looking for is something like that

   [0] => Tester
   [1] => Test

How do i do that?

  • 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-15T20:03:32+00:00Added an answer on May 15, 2026 at 8:03 pm

    array_key_exists – http://php.net/manual/en/function.array-key-exists.php

    foreach($first_array as $arr) {
        foreach($second_array as $key=>$val)
        {
            if (array_key_exists($val, $first_array)) {
                $final_array[$key] = $arr['name'];
            }
        }
    }
    

    or array_search – http://uk.php.net/array_search

    foreach($first_array as $arr) {
        foreach($second_array as $val)
        {
            $key = array_search($val, $arr);
            if($key !== false) $final_array[$key] = $arr['name'];
        }
    }
    

    In both cases you should end up with:

       [0] => Tester
       [1] => Test
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It means that self could be made nil by the… May 16, 2026 at 12:15 pm
  • Editorial Team
    Editorial Team added an answer I've used the web browser control, but haven't used GeckoFX.… May 16, 2026 at 12:15 pm
  • Editorial Team
    Editorial Team added an answer I did the question, because there's not enough information on… May 16, 2026 at 12:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm stuck with a problem how to check if a specific date is within
Is there any way to check if a array exists or has a value
Background Similar to this question , I need to determine if an entity in
I defined this simple method: public static boolean isBorder(int x, int y) throws CollisionDetectionException
What's the best way to get an array of all elements in an html
Possible Duplicate: How to check if an object is serializable in C# Recently found
I am trying to perform a check on individual nodes of an XML file,
My project requires that I update the contents of a specific column in an
I have a structure which has 3 identifier fields and one value field. I
(SOLVED, SEE END) I need hints on the PHP or MySQL code structure for

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.