how to compare two arrays elements by key in javascript code example
Example: compare key and one array
$array_new = [];
foreach($array_two as $key)
{
if(array_key_exists($key, $array_one))
{
$array_new[$key] = $array_one[$key];
}
}