I made a test that sends values ββto POST, there is also an array with the correct values, foreach processes it all. But even if in two arrays the same data, it is considered as incorrect.
$q[1]['true_answers'] = [2, 5]; if (is_array($_POST['q1'])) { $q1_request = $_POST['q1']; foreach ($q1_request as $answer) { echo $answer."\n"; } } foreach ($q[1]['true_answers'] as $ans){ echo $ans."\n"; } if($ans === $answer){ $goodq[] = "β1"; } else { $badq[] = "β1"; }