$post = array (
'one' => '1'
'two' => '2'
'three' => '3'
)
$rules = array (
'one' => '1', '2', '3'
'two' => '7', '9'
'three' => '7','3','9'
)
<?php
$post = array (
'one' => '1',
'two' => '2',
'three' => '3'
);
$rules = array (
'one' => array('1', '2', '3'),
'two' => array('7', '9'),
'three' => array('7','3','9')
);
function getArr($post, $rules) {
$res = array();
foreach($post as $key => $p) {
if(isset($rules[$key]) && is_array($rules[$key]) && in_array($p, $rules[$key])) {
$res[] = $key;
}
}
return $res;
}
$res = getArr($post, $rules);
print_r($res);