Removing duplicates out of multiple arrays, php

I've got multiple arrays, and want to remove the duplicates. So I only got the unique items.

array(4) {
 [0]=>
  string(14) "Bergen op Zoom"
 [1]=>
  string(9) "jan steen"
 [2]=>
  string(7) "culture"
 [3]=>
  string(11) "Netherlands"
}

array(8) {
 [0]=>
  string(14) "fasion"
 [1]=>
  string(9) "conceptial"
 [2]=>
  string(7) "industrial"
 [3]=>
  string(11) "Netherlands"
}

I want to print all the strings out of the array except for the last Netherlands because it's already printed.

I've tried it with array_unique() but it only does that if there are duplicates in the array itself.

no clue how to get this thing working..

Answers


Try this

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

Use array_diff. It will stay in arr1 only items that not in arr2

array_diff($arr1, $arr2);

Need Your Help

Redis Multi-Set With a TTL

redis key-value-store ttl

In redis there is a SETEX command that allows me to set a key that expires, is there a multi-set version of this command that also has a TTL?

How to combine many(1000) png file together in one big file system where we can iterate and get all if needed

java hadoop

I am putting many images on HDFS. However each one is taking 64MB Block there.As the count of images are very high So wanted to put all image information in one big file. Now this will be feed to ...