I have an array like this

$arr1 = Array
(
    [0] => 0
    [1] => 0
    [2] => 0
    [3] => 1
    [4] => 1
    [5] => 1
    [6] => 0
)
$arr2 = Array
(
    [0] => 1
    [1] => 0
    [2] => 0
    [3] => 0
    [4] => 0
    [5] => 0
    [6] => 1
)

I want to create a new array with the values of a2 as keys in $arr1. My resultant array should be like this

$arr3 = Array
(
    [0] => $arr1 = Array
(
    [0] => 0
    [1] => 0
    [2] => 0
    [3] => 1
    [4] => 1
    [5] => 1
    [6] => 0
)
    [1] => $arr2 = Array
(
    [0] => 1
    [1] => 0
    [2] => 0
    [3] => 0
    [4] => 0
    [5] => 0
    [6] => 1
)
)

Note : All are in a for loop. Plz help me..

share|improve this question

1  
How does your example reflect the statement that you expect the values of the second array to be the keys in the first array? – Gumbo Mar 3 at 7:11
feedback

1 Answer

up vote 1 down vote accepted
$arr3= array($arr1, $arr2);

It is simple.

share|improve this answer
array key should be unique – FirmView Mar 3 at 7:05
Thanks.. I got the result.. – GARB Mar 3 at 7:34
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.