Q:

if two array key matches then create a new array with their values

I have two array. I want to merge then based on their key match. Here is my first array 
array(
  (int) 1 => 'Home',
  (int) 7 => 'FAQs',
  (int) 16 => 'Roles',
  (int) 21 => 'Terms & Condition',
  (int) 24 => 'Registration',
  (int) 4 => 'Posts'
)

My second array
array(
   (int) 4 => array(
            (int) 0 => 'All Posts',
            (int) 1 => 'Post Add'
   ),
   (int) 7 => array(
            (int) 0 => 'FAQ Add',
            (int) 1 => 'All FAQs'
   ),
   (int) 16 => array(
            (int) 0 => 'Add Role',
            (int) 1 => 'All Role & Actions'
   ),
   (int) 21 => array(
              (int) 0 => 'Add Terms & Condition',
              (int) 1 => 'Terms & Conditions'
    )
 )

What I want to do is to create a new array with their values if key matches.like
this way. Is this even possible to merge them like this ?
 array(
   'Posts' => array(
            (int) 0 => 'All Posts',
            (int) 1 => 'Post Add'
   ),
   'FAQs' => array(
            (int) 0 => 'FAQ Add',
            (int) 1 => 'All FAQs'
   ),
   'Registration' => array(),
   'Home'=>array(),
   'Roles' => array(
            (int) 0 => 'Add Role',
            (int) 1 => 'All Role & Actions'
   ),
   'Terms & Condition' => array(
              (int) 0 => 'Add Terms & Condition',
              (int) 1 => 'Terms & Conditions'
    )
 )

A:

try
<?php
$new_array = array();
foreach($first_array as $key=>$value){
    if(array_key_exists($key, $second_array)){  
     $new_aray[$value] = $arr2[$key];   
    }
}
print_r($new_array);

hope it helps :)

