I need a function to return 3. I thought this would but doesnt :
Code: Select all
echo array_search(array('a','b','c'),array_keys($_POST));Any other way ?
Thanks
Moderator: General Moderators
Code: Select all
echo array_search(array('a','b','c'),array_keys($_POST));Code: Select all
$reqd = array('a', 'b', 'c');
$check = 0;
foreach ($reqd as $v) {
if (array_key_exists($v, $_POST)) {
$check++;
}
}
if ($check == count($reqd)) {
//All OK
}