-2
Array ( [0] => tirupur ) 
Array ( [0] => coimbatore ) 
Array ( [0] => coimbatore [1] => chennai ) 
Array ( [0] => coimbatore [1] => chennai [2] => madurai ) 
Array ( [0] => bangalore ) 

I want the final array to be like below output

Array ( [0] => tirupur [1]=>coimbatore [2]=>chennai [3]=>madurai [4]=>bangalore)
4

2 回答 2

0

you can combine first all array in to one array and then try to do like this way

<?php
$array1 = array("orange", "apple", "grape");
$array2 = array("peach", 88, "plumb");
$array3 = array("lemon", 342);
$newArray = array_merge($array1, $array2, $array3);

array_unique($newArray);

hope this will sure help you

于 2013-07-31T06:36:13.827 回答
0

As a solution to your problem please try executing the following code snippet

  $a=array('tirupur');
  $b=array('coimbatore');
  $c=array('coimbatore','chennai');
  $d=array('coimbatore','chennai','madurai');
  $e=array('bangalore');
  $x=array_unique(array_merge($a,$b,$c,$d,$e));
  $result=array_values($x);
  print_r($result);
 ?>
于 2013-07-31T06:41:55.773 回答