PHP在数组中添加数组[关闭]

I have two arrays like this:

array1

 Array
(
    [0] => 'apple'
    [1] => 'banana'
)

and array2

Array
(
    [0] => 3
    [1] => 2
)

all i want to do is this:

Array
(
    [0] => Array
        (
            [0] => 'apple'
            [1] => 3
         )

    [1] => Array
        (
            [0] => 'banana'
            [1] => 2
         )

)

thanks for your time to answer my question

Assuming you have both arrays with the same length:

$arr1 = array('apple','banana');
$arr2 = array('3','2');
$result = array();
foreach($arr1 as $key=>$value)
{
   $result[$key] = array($value,$arr2[$key]);
}
$result = array();
foreach ($array1 as $i => $val) {
    $result[] = array($val, $array2[$i]);
}