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 in Others by krishna
• 2,640 points
36 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 in Others by krishna
• 2,640 points
51 views
0 votes
0 answers

Getting a union of two arrays in JavaScript

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

Aug 18 in Others by krishna
• 2,640 points
30 views
+1 vote
0 answers

How to split a number with coma betweeen two colunms

Jul 3, 2019 in Others by anonymous
185 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,360 points
1,777 views
0 votes
1 answer

How to run two commands in one line in Windows CMD?

Hi@MD, You can use the Logical And operator ...READ MORE

answered Oct 5, 2020 in Others by akhtar
• 38,230 points
3,830 views
0 votes
0 answers

How to compare two excel sheets

How to compare two excel sheets , ...READ MORE

Jul 18, 2021 in Others by Sri
• 3,190 points
194 views
0 votes
0 answers

Combine two arrays

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

Jun 18 in PHP by narikkadan
• 21,680 points
46 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
4,053 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,780 points
5,357 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 in PHP by Aditya
• 7,660 points
367 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