我有三个数组作为array1 array2 array3,我希望这个组合像array4一样。
array1
(
[1869] => 1
[1871] => 1
[0] => 2
[1807] => 1
[1875] => 1
[1811] => 1
[1877] => 1
[1878] => 1
[1879] => 1
[1880] => 1
[1886] => 1
[1850] => 2
[1618] => 3
[1679] => 1
)
array2
(
[1619] => 1
[1625] => 1
)
array3
(
[1111] => 1
[2222] => 1
)
需要输出如:
array4
(
[1869] => 1
[1871] => 1
[0] => 2
[1807] => 1
[1875] => 1
[1811] => 1
[1877] => 1
[1878] => 1
[1879] => 1
[1880] => 1
[1886] => 1
[1850] => 2
[1618] => 3
[1679] => 1
[1619] => 1
[1625] => 1
[1111] => 1
[2222] => 1
)
我希望这个array1和array2像array3一样组合。请帮助我一些。谢谢。
答案 0 :(得分:4)
如果每个数组都在一个变量上,你可以这样做,
String winHandleBefore = driver.getWindowHandle();
//All tab's id (security + toolsQA) and storing it.
Set<String> all = driver.getWindowHandles();
//Get all the tab id's including security and iterate
for(String winHandle : driver.getWindowHandles())
{
if(winHandle.equals(winHandleBefore))
{
//Condition satisfied. Switching to the security tab and closing it
driver.switchTo().window(winHandle);
driver.close();
}
}
//Now the security tab will be closed we need to switch to the toolsQA whose id is in "all"
//Removing the security tab id from all.
all.remove(winHandleBefore);
//Now we have only one toolsqa id in "all"
for(String winHandle : all)
{
driver.switchTo().window(winHandle);
//Now in toolsQA
这样你也不会松开钥匙。查看手册here。
答案 1 :(得分:1)
或者
$array1 = array('1869' => 1,'1871' => 1,'0' => 2,'1807' => 1,'1875' => 1,'1811' => 1,'1877' => 1,'1878' => 1,'1879' => 1,'1880' => 1,'1886' => 1,'1850' => 2,'1618' => 3,'1679' => 1);
$array2 = array('1619' => 1,'1625' => 1);
$array3 = array('1111' => 1,'2222' => 1);
$newArray = array_replace( $array1,$array2,$array3);
但我认为只使用+
是首选。
print_r($newArray);