Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $array_one = ["Vikings","Eagles","Jaguars","Patriots"];
- $array_two = [
- "Vikings"=>1,
- "Eagles"=>1,
- "Jaguars"=>1,
- "Patriots"=>1
- ]
- //Validate using array 1
- if(in_array($user_input,$array_one)) {
- echo "Valid Input";
- }
- //Validate using array2
- if(array_key_exists($user_input,$array_two)) {
- echo "Valid Input";
- }
Add Comment
Please, Sign In to add comment