Array ( [0] => tirupur )
Array ( [0] => coimbatore )
Array ( [0] => coimbatore [1] => chennai )
Array ( [0] => coimbatore [1] => chennai [2] => madurai )
Array ( [0] => bangalore )
我希望最终数组类似于输出
Array ( [0] => tirupur [1]=>coimbatore [2]=>chennai [3]=>madurai [4]=>bangalore)
答案 0 :(得分:0)
你可以先将所有数组合并到一个数组中,然后尝试这样做
<?php
$array1 = array("orange", "apple", "grape");
$array2 = array("peach", 88, "plumb");
$array3 = array("lemon", 342);
$newArray = array_merge($array1, $array2, $array3);
array_unique($newArray);
希望这一定会帮到你
答案 1 :(得分:0)
作为问题的解决方案,请尝试执行以下代码段
$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);
?>