How can I only allow the characters W, L, and D in a string? I have written this
if ((strpos($input, 'w') === false)
&& (strpos($input, 'd') === false)
&& (strpos($input, 'l') === false)) {
$answer = "FALSE";
} else {
$answer = "TRUE";
}
but this only works if all the characters are W, L, D or none of the characters are W, L or D. I cant work out how to get it to spot when just some of the characters are incorrect.
eg
wwwlld = TRUE (correct)
12aab6 = FALSE (correct)
www44d = TRUE (incorrect, this needs to be FALSE as it contains '44')
Any help much appreciated.
P