Guest User

Untitled

a guest
Jan 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. $array_one = ["Vikings","Eagles","Jaguars","Patriots"];
  2. $array_two = [
  3. "Vikings"=>1,
  4. "Eagles"=>1,
  5. "Jaguars"=>1,
  6. "Patriots"=>1
  7. ]
  8.  
  9. //Validate using array 1
  10. if(in_array($user_input,$array_one)) {
  11. echo "Valid Input";
  12. }
  13.  
  14. //Validate using array2
  15. if(array_key_exists($user_input,$array_two)) {
  16. echo "Valid Input";
  17. }
Add Comment
Please, Sign In to add comment