there is an array of allowed fields and the array with the data you need to find a convergence:
$allowed = ['id', 'type', 'url'];
$data = ['id' => 1, 'type' => 2, 'url' => 'toster.ru', 'other' => 'that seems excessive.'];
How can I leave only the allowed fields?
Now I only have 2 solutions:
1 - array_intersect_key (But it only works with associative arrays have allowed to do not beautiful)
2 - Bust cycle is allowed and keys to form a new pulling values from the second array (But I'm sure it's some kind of crutch, and it is possible to solve the standard functions of language)
array_intersect_ukey - works on random brand compares if the keys did not fit unfortunately.
Please tell me how to do?
PS MB Yii is already implemented ? - at the docks ArrayHelper I found this