Combine two arrays

0 votes

I have two arrays structures like this

array( 
'11' => '11',
'22' => '22',
'33' => '33',
'44' => '44'
);

array( 
'44' => '44',
'55' => '55',
'66' => '66',
'77' => '77'
);

I wanna combine these two. And this should occur in a way that there are no duplicates available in the resulting output as well as their original keys

array( 
'11' => '11',
'22' => '22',
'33' => '33',
'44' => '44',
'55' => '55',
'66' => '66',
'77' => '77'
);

I implemented this method suggested by my friend by it is not working. Any ideas?

$output = array_unique( array_merge( $array1 , $array2 ) );

Aug 8, 2022 in Others by krishna
• 2,820 points
445 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Others

0 votes
0 answers

median of two sorted arrays

So I saw this post where the ...READ MORE

Aug 1, 2022 in Others by krishna
• 2,820 points
341 views
0 votes
0 answers

Getting a union of two arrays in JavaScript

Say I have two arrays: one with ...READ MORE

Aug 18, 2022 in Others by krishna
• 2,820 points
259 views
0 votes
0 answers

How to merge two sorted arrays into a sorted array?

this question was asked in interview  public static ...READ MORE

Nov 17, 2022 in Others by Ashwini
• 5,430 points
332 views
0 votes
1 answer

Combine Two Formulas in Separate Cells Into One Cell

Use the openpyxl module in Python to do that, ...READ MORE

answered Mar 26, 2023 in Others by Kithuzzz
• 38,010 points
547 views
+1 vote
0 answers

How to split a number with coma betweeen two colunms

Jul 3, 2019 in Others by anonymous
490 views
0 votes
1 answer

How to give space between two Textfield in Flutter?

Hi@akhtar, There is various way to give space ...READ MORE

answered Sep 8, 2020 in Others by MD
• 95,440 points
4,223 views
0 votes
0 answers

Combine two arrays

I have two arrays like this: array( '11' ...READ MORE

Jun 18, 2022 in PHP by narikkadan
• 63,420 points
348 views
0 votes
1 answer

How to check if array is multidimensional or not?

Since the 'second dimension' could be just ...READ MORE

answered Nov 5, 2018 in Others by DataKing99
• 8,240 points
5,290 views
0 votes
1 answer

How to store input value into array then localstorage?

Hello @ abhittac, You have create the array everytime the ...READ MORE

answered Jul 24, 2020 in Java-Script by Niroj
• 82,880 points
8,688 views
0 votes
1 answer

Convert a PHP object to an associative array

Start with simply typecasting the line:- $array = ...READ MORE

answered Feb 23, 2022 in PHP by Aditya
• 7,680 points
1,693 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP