<?php
$incomingData = [
    'allowed'     => 23,
    'alsoAllowed' => 42,
    'notAllowed'  => 'foo',
];

$allowedKeys = ['allowed', 'alsoAllowed'];

$validIncoming = array_intersect_key($incomingData, array_flip($allowedKeys));
var_dump($validIncoming);
