Question: I have two arrays like below example..

```
 $arr1 = array("0" => "1");
 $arr2 = array("2" => "3");

```

i want to make two different array by merging all the keys in one array and and all the values inside another array.

Expected output..

```
$arr3 = array("0" => "2");
$arr4 = array("1" => "3");

```

Answer: 
You can do it like that, using [array\_keys](http://php.net/manual/en/function.array-keys.php) and [array\_vals](http://php.net/manual/en/function.array-values.php):

```
<?
    $arr1 = array("0" => "1");
    $arr2 = array("2" => "3");
    $a1_keys = array_keys($arr1);
    $a1_vals = array_values($arr1);
    $a2_keys = array_keys($arr2);
    $a2_vals = array_values($arr2);
    $keys_merge = array();
    $vals_merge = array();
    for ($i = 0; $i < count($arr1); $i++) {
        $keys_merge[$a1_keys[$i]] = $a2_keys[$i];
        $vals_merge[$a1_vals[$i]] = $a2_vals[$i];
    }
    print_r($keys_merge);
    print_r($vals_merge);

```

Script above assumes that You have correctly formatted arrays.
Perhaps you can use [array\_combine()](http://php.net/manual/en/function.array-combine.php)

```
<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);

print_r($c);
?>

```