"PHP array merge issues

22 days ago"
     
  

This question already has an answer here:

     
  

Here is my output: im using more foreach loop with different condition and values put into same array name $returnVal[]=


EX:


foreach($val1 as $vals)  {   $returnVal[]=$vals;  }

  foreach($val2 as $vals)   {   $returnVal[]=$vals;   }

foreach($val3 as $vals)   {   $returnVal[]=$vals;   }

foreach($val4 as $vals)   {   $returnVal[]=$vals;   } `  

Im getting Output:


Array   (   [0] => Array   (   [0] => 39705--COLUMBUS--LOWNDES--MS   [1] => 39702--COLUMBUS--LOWNDES--MS   [2] => 39710--COLUMBUS--LOWNDES--MS   [3] => 39701--COLUMBUS--LOWNDES--MS   )
[1] => Array   (   [0] => Array   (   [0] => 39705--COLUMBUS--LOWNDES--MS   [1] => 39702--COLUMBUS--LOWNDES--MS   [2] => 39710--COLUMBUS--LOWNDES--MS   [3] => 39701--COLUMBUS--LOWNDES--MS   )
)
[2] => Array   (   [0] => Array   (   [0] => 39705--COLUMBUS--LOWNDES--MS   [1] => 39702--COLUMBUS--LOWNDES--MS   [2] => 39710--COLUMBUS--LOWNDES--MS   [3] => 39701--COLUMBUS--LOWNDES--MS   )
[1] => Array   (   [0] => Array   (   [0] => 39705--COLUMBUS--LOWNDES--MS   [1] => 39702--COLUMBUS--LOWNDES--MS   [2] => 39710--COLUMBUS--LOWNDES--MS   [3] => 39701--COLUMBUS--LOWNDES--MS   )
)
[2] => 57038--JEFFERSON--UNION--SD   )
[3] => 57049--NORTH SIOUX CITY--UNION--SD   )  

My Question: remove duplicate values and merge into one level

  
"
answer1
  
  

Push element if it is not exists in the result array