Is there a better way to combine these arrays?
Using in_array can be droped one foreach

$result = array();
foreach ($array['Permission'] as $key =&gt; $value) {
  if (in_array($key, $array['Moduleid'])) {
     $result[$key] = $value;
  }
}