我得到了以下o / p
$test1=["12","54","87","98"];
$test2=["1","5","8","9"];
在那里我如何将上面两个变量连接到一个变量,如下面的
1是12的关键, 5是54的关键, 8是87的关键, 9是98的关键,
答案 0 :(得分:2)
试试这个:
$test1=["12","54","87","98"];
$test2=["1","5","8","9"];
$a = array_combine($test2, $test1);
echo "<pre>";
print_r($a);
exit;
希望这有帮助。
和平!的xD
答案 1 :(得分:1)
你可以试试这个
$test1=["12","54","87","98"];
$test2=["1","5","8","9"];
$new_array = array();
$i = 0;
foreach( $test2 as $key=> $value )
{
$new_array[$value] = $test1[$i];
$i++;
}
echo '<pre>';
print_r($new_array);