php - How to check if a string is in an array? -


I need a basic function to check whether I am in the string of characters (each letter) in the array.

My code is not working yet, but here it is,

  $ allowed chars = array ("a", "b", "c "I", "I", "I", "O", "I", "I", "I", "I", "I", "I", "I" "P", "X", "R", "S", "T", "U", "V", "Y", "X", "Y", "Z", "A", "B "", "C", "d", "e", "f", "jee", "h", "me", "j", "k", "l", "m", "n" O "," P "," R "," S "," R "," S "," T "," U "," V "," W "," X "," Y "," Z " , "9", "", "@", "2", "3", "4", "5", "6", "7", "8" . "," - "," _ "," + "," "); $ input =" test "; $ Input = str_split ($ input); Ghar (in_are ($ input, $ chairs allowed)) {echo "yes, found".}} {Echo "sniff, not found ...";}  

I Wish says, 'Yes, found.' If any letter from $ input is found in $ permission is quite simple, is not it? Well, it does not work, and I have not found any function for the value of an array String will search for different characters.

By the way, I want it to be just that array's value, I have fancy html_strip_entities or whatever, I use that exact array for allowed characters Want you. ">

Regex and preg_match function Do not check:

However, this should work with your specific request:

  $ Permitted Chars = array ("a", "b", "c "", "M" "n", "o", "d", "e", "f", "j", "j", "me", "j", "k" P "," S "," T "," U "," V "," W "," X "," Y "," Z "," A "," B "," "A", "K", "L", "M", "N", "O", "F", "G", "H", "I", "J" , "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "", "0 "," "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 "," "," @ ",". - "," _ "," + "," "); $ Input = "test"; $ Input = str_split ($ input); $ Message = "Ah, did not get ..."; Foreign currency (input as $ letter $ letter) {if (in_array ($ characters, $ charged with permission)) {$ message = "Yep, found."; break; }} $ Message echo;  

Comments