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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:09:57+00:00 2026-06-12T04:09:57+00:00

I have been able to search a multidimensional array like Array ( [0] =>

  • 0

I have been able to search a multidimensional array like

Array
(
    [0] => Array
        (
            [size] => 39
            [colour] => N/A
            [quantity] => 5
        )

    [1] => Array
        (
            [size] => 35
            [colour] => N/A
            [quantity] => 5
        )

    [2] => Array
        (
            [size] => 40
            [colour] => N/A
            [quantity] => 5
        )

    [3] => Array
        (
            [size] => 30
            [colour] => N/A
            [quantity] => 5
        )

)

And return the matching an array of matches like this

Array
(
    [size] => 35
    [colour] => N/A
    [quantity] => 5
)

using this snippet

$result = array();
foreach ($multi_array as $arr) {
  if ($arr['size'] == $one_dimen_arr['size'] && $arr['colour'] == $one_dimen_arr['colour']) {
    $result = $arr;
    break;
  }
}

is it possible to remove the match from the master multidimensional array and replace with an updated array in that position?

  • 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-12T04:09:58+00:00Added an answer on June 12, 2026 at 4:09 am

    Try it like this

    $result = array();
    foreach ($multi_array as $key => $arr) {
      if (
         $arr['size'] == $one_dimen_arr['size'] && 
         $arr['colour'] == $one_dimen_arr['colour']
      ) {
        $result = $arr;
        unset($multi_array[$key])  //to remove the matching array
        $multi_array[$key] = $yourUpdatedArr; //to update the values
        break;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have been able to extract a VARCHAR to a date using string_to_date
I have this excel file which I have been able to write the data
Recently search engines have been able to page dynamic content on social networking sites.
I'm using a jqGrid with a filterToolbar and though I have been able to
In other sites I've worked on, I have been able to easily generate search
I am sure this is possible but I have not been able to find
I have been able to run my C# .net 3.5 app just fine on
I have been able to make my photos large for single photo posts on
I have been able to find lots of examples of adding a Dropdown list
I have been able to design my layout so that it has 2 columns

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.