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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -