Currently, this is what I do to check if all keys of an array **$A** are **within a subset** of another array **$B**.

```
$B = array('a', 'b', 'c', 'd');

if(array_keys($A) == array_intersect(array_keys($A), $B))
{
 action if true
}

```

I am wondering if there is a more straight forward way of doing this, something like the `in_array()` function.

**Usage Example**:

Checking the $\_POST array to ensure that all keys matches a dynamic form and filter out extra keys if the form is hacked.