1

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..

1
  • 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? Commented Mar 3, 2012 at 7:11

1 Answer 1

2
$arr3= array($arr1, $arr2);

It is simple.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.