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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:31:40+00:00 2026-06-17T10:31:40+00:00

Array #1 looks something like this (simplified): Array ( [Appetizers] => Array ( [0]

  • 0

Array #1 looks something like this (simplified):

Array
(
    [Appetizers] => Array
        (
            [0] => Array
                (
                    [category] => Appetizers
                    [name] => Beef Tenderloin Carpaccio
                )

            [1] => Array
                (
                    [category] => Appetizers
                    [name] => Calamari Fritto Misto
                )    
        )

    [Flatbreads] => Array
        (
            [0] => Array
                (
                    [category] => Flatbreads
                    [name] => Quattro Formaggi
                )

            [1] => Array
                (
                    [category] => Flatbreads
                    [name] => Tomato & Burrata
                )

        )
)

Array #2 Looks like this:

Array
(
    [0] => Array
        (
            [category] => Appetizers
            [note] => Choose One Item From Each Category
        )

    [1] => Array
        (
            [category] => Flatbreads
            [note] => with Shoestring or Wedge Potatoes
        )

)

How would I be able to merge the [‘note’] from Array #2 into Array #1, based on a match of the Array #1’s category KEY with Array #2’s ‘category’ VALUE? So the result is like this:

Array
(
    [Appetizers] => Array
        (
            [0] => Array
                (
                    [category] => Appetizers
                    [name] => Beef Tenderloin Carpaccio
                    [note] => Choose One Item From Each Category
                )

            [1] => Array
                (
                    [category] => Appetizers
                    [name] => Calamari Fritto Misto
                    [note] => Choose One Item From Each Category
                )    
        )

    [Flatbreads] => Array
        (
            [0] => Array
                (
                    [category] => Flatbreads
                    [name] => Quattro Formaggi
                    [note] => with Shoestring or Wedge Potatoes
               )

            [1] => Array
                (
                    [category] => Flatbreads
                    [name] => Tomato & Burrata
                    [note] => with Shoestring or Wedge Potatoes
                )

        )
)
  • 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-17T10:31:41+00:00Added an answer on June 17, 2026 at 10:31 am

    Try this

    $courses = array( 'Appetizers' => array( array( 'category' => 'Appetizers', 'name' => 'Beef Tenderloin' ), array( 'category' => 'Appetizers', 'name' => 'Calamari' ) ) );
    
    $notes = array( array( 'category' => 'Appetizers', 'note' => 'Choose One Item From Each Category' ) );
    
    function note( $key, $array ) {
        foreach( $array as $element )
            if( $element['category']  == $key )
                return $element['note'];
        return '';
    }
    
    foreach( $courses as $key => &$course ) {
        $course = array_map( function( $el ) use( $notes ) {
            $el['note'] = note( $el['category'], $notes );
            return $el;
        }, $course );
    }
    print_r( $courses );
    

    It generates

    Array
    (
        [Appetizers] => Array
            (
                [0] => Array
                    (
                        [category] => Appetizers
                        [name] => Beef Tenderloin
                        [note] => Choose One Item From Each Category
                    )
    
                [1] => Array
                    (
                        [category] => Appetizers
                        [name] => Calamari
                        [note] => Choose One Item From Each Category
                    )
    
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ruby array that looks something like this: my_array = ['mushroom', 'beef',
I have an array that looks something like this: Array ( [0] => apple
I have an array that looks something like this: $array[] = 'MT0001ENG Apricot, dried';
I have a json object that looks something like this: Array ( [algorithm] =>
I have a very large 2D array which looks something like this: a= [[a1,
The array looks something like this: $array = array( array( 'Item' => array(47, 48,
I have an array that looks something like this array(7) { [0]=> hello,pat1 [1]=>
I have an array that looks something like this array( 'cars' => 10, 'trucks'
I have an array that looks something like this: Array ( [Erik] => Array
I have an array that looks something like this: Array ( [1] => Array

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.