PHP - detect whitespace between strings

后端 未结 7 2351
情书的邮戳
情书的邮戳 2020-12-03 09:42

How would I go about detecting whitespace within a string? For example, I have a name string like:

\"Jane Doe\"

Keep in mind that I don\'t want to trim or re

7条回答
  •  温柔的废话
    2020-12-03 10:39

    // returns no. of matches if $str has nothing but alphabets,digits and spaces. function 
    
        is_alnumspace($str) {
              return preg_match('/^[A-Za-z0-9 ]+$/i',$str);
        }
    
    // This variation allows uppercase and lowercase letters.
    

提交回复
热议问题