This is my array:
$keyArr = array(12345 => array("somto@gmail.com", "james@yahoo.com",), 54321 => array("munz@gmail.com",));
Here's my statement:
foreach ($keyArr as $dbkey => $dbvalue){
if (!in_array($email, $dbvalue) && $dbkey != $key || in_array($email, $dbvalue) && $dbkey != $key || !in_array($email, $dbvalue) && $dbkey == $key){
$errors['key'] = "Invalid email or key!";
}
}
Say I create a variable that exists in $keyArr such as:
$key = 12345;
$email = "somto@gmail.com";
I expect no output from the program, because the values of $key and $email exist in $keyArr, but I still get the "Invalid email or key!" message.