PHP Validation String Does Not Contain List Of Values -
for example might:
$exclude_values = ['/','.']; $check_string = 'asdf/'; $return = 'valid'; foreach($exclude_values $value) { if(strpos($value,$check_string) != false) { $return = 'invalid'; } } return $return;
is there better way this? i've seen examples of single checks on stack not multiple values
i can't recommend string searching function outside multibyte or pcre lib, because not utf-8 compatible, , you'll have strange errors sooner or later.
in case regex better solution:
return !preg_match('%[/\.]%usd', $check_string);
Comments
Post a Comment