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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:25:56+00:00 2026-05-14T14:25:56+00:00

I have an array as follows array(2) { [operator] => array(2) { [qty] =>

  • 0

I have an array as follows

array(2) {
  ["operator"] => array(2) {
    ["qty"] => int(2)
    ["id"] => int(251)
  }
  ["accessory209"] => array(2) {
    ["qty"] => int(1)
    ["id"] => int(209)
  }
  ["accessory211"] => array(2) {
    ["qty"] => int(1)
    ["id"] => int(211)
  }
}

I’m trying to find a way to verify an id value exists within the array and return bool. I’m trying to figure out a quick way that doesn’t require creating a loop. Using the in_array function did not work, and I also read that it is quite slow.

In the php manual someone recommended using flip_array() and then isset(), but I can’t get it to work for a 2-d array.

doing something like

if($array['accessory']['id'] == 211)

would also work for me, but I need to match all keys containing accessory — not sure how to do that

Anyways, I’m spinning in circles, and could use some help.
This seems like it should be easy. Thanks.

  • 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-14T14:25:56+00:00Added an answer on May 14, 2026 at 2:25 pm

    array_walk() can be used to check whether a particular value is within the array; – it iterates through all the array elements which are passed to the function provided as second argument. For example, the function can be called as in the following code.

    function checkValue($value, $key) {
      echo $value['id'];
    }
    
    $arr = array(
      'one' => array('id' => 1),
      'two' => array('id' => 2),
      'three' => array('id' => 3)
    );
    
    array_walk($arr, 'checkValue');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have declared an array as follows: int *arr; Is there any way in
I have a row-major iterator to a 2D array, with derefence operator as follows:
I have a template method as follows:- template<typename T, int length> void ProcessArray(T array[length])
I have allocated an array as follows. #include <iostream> int main() { const int
I have have an array as follows: $row when I output the entire array
I have a double array as follows: $values[$ids][$dates] So for each $id I have
Background I have an array of objects (Users) defined and set as follows: //
I have php code that puts some values into an Array as follows: $hunter=addslashes($MessageArray[1]);
My problem is as follows. I have an array of objects in the form
For development of web services, i have to make multilevel Associative array as follows

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.