Is there any way to see if a string has a capital letter anywhere in it? example: $str = "Has a capital letter." if ($str has a capital letter) { do this; }
I don't think it is effective method, but: $str = "Has a capital letter."; if ($str!=strtolower($str)){ echo "+"; } PHP:
I think you can do a preg_match for the first letter in the string. I'm not sure on the exact regex, but pcre allows you to match by upper or lower case letters independently [A-Z] or [a-z]. Something like; if(preg_match('/[A-Z]/',trim($string['0']))){ //uppercase letter } else { //Not uppercase } PHP: The above post would work, but would return false if there was any uppercase letter, not just the first letter.