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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:21:22+00:00 2026-05-26T07:21:22+00:00

I combined two arrays to create the following array, named $group_wages_array : Array (

  • 0

I combined two arrays to create the following array, named $group_wages_array:

Array ( [1] => 500 [4] => 44 [6] => 80 [3] => 11.25 )

I am trying to test if the array key matches X, set a variable as it’s value. Here’s what I have:

NOTE: This whole thing is executed in a while loop, so the value of $thegroup[‘group_id’] will change. I’ve set it’s value as “6” for this example.

$thegroup['group_id'] = "6" // This particular group (for simplicity)

if (array_key_exists($thegroup['group_id'], $group_wages_array)) {

    $this_wages = // Need this to be 80... how do I do it?

}

So, how do I get $this_wages to equal the key value?

  • 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-26T07:21:23+00:00Added an answer on May 26, 2026 at 7:21 am

    You just use the key from the array to get it:

    $thegroup['group_id'] = "6" // This particular group (for simplicity)
    
    if (array_key_exists($thegroup['group_id'], $group_wages_array)) {
        $this_wages = $group_wages_array[$thegroup['group_id']];
    }
    

    Also, the array keys are not 0,1,2,etc because you explicitly set them in Array ( [1] => 500 [4] => 44 [6] => 80 [3] => 11.25 )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i combine two arrays in to a single array during compound selection
I am trying to compare two byte arrays in memory and produce a data
We have two set of string arrays, e.g.: string[] a = new string[] {value1,value2,value3};
i am trying to combine two arrays with their relations but cant do exatly.
status_name=Array(a,b,c,b,e,f); status_id=Array( 1, 2, 3, 4, 5, 6); How to combine these two arrays
TEST SITE Look here to see code in action I have two arrays which
Let's ets say I have two arrays: $arr1 = array("a","b","c"); $arr2 = array("1","2","3"); function
A PHP question about arrays. Suppose we have two arrays: [first] => Array (
I want to combine two array's, excluding duplicates. I am using a custom class:
Scenario I have two WCF Services combined in a single App.Config file. I can't

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.