Mattraks How do I cheat?
Reputation: 0
Joined: 21 Oct 2007 Posts: 0 Location: IRAQ!
|
Posted: Sat Nov 01, 2008 4:26 pm Post subject: [PHP] Seeing if a character is not one of those in an array |
|
|
| Code: | function CheckIncLink($path){
$legal_strings = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "/");
foreach($legal_strings as $lstring){
$bTempGood = false;
for($i=1; $i<strlen($path)+1; $i++){
if(strcmp(StrToLower($path[$i]), $lstring) == 0){
$bTempGood = true;
break;
}
}
if($bTempGood == false) {
return false;
}
}
return true;
} |
Well, its supposed to check each character in $path and if it isn't one in the array, then it will return false. It always returns true. Anyone know how to fix it?
_________________
FOR ALLAH! |
|