So I have an array of acceptable animals:
$animals = array('tiger','lion','dog');
How can I see if the animal submitted by the user:
$userSubmittedAnimal = clean($_POST['animal']);
matches one of the 3 acceptable ones?
in_array — Checks if a value exists in an array
$animals = array('tiger','lion','dog');
$userSubmittedAnimal = clean($_POST['animal']);
if (in_array($userSubmittedAnimal, $animals )) {
echo "It's in the array";
}