Home >Backend Development >PHP Tutorial >PHP determines uppercase and lowercase letters function
Provide a simple example of PHP function to determine uppercase and lowercase letters. It can find out how many uppercase letters and lowercase letters a string has. It is a very convenient and commonly used function. The code is as follows:
function checkcase($str){ _ If (preg_match ('/^[a-z]+$/', $ str)) {
echo 'lowercase letter'; ; ;
function checkcase1($str){
$str = ord($str);
if($str>64&&$str<91 ){
echo 'capital letters';
return;
}
If($str>96&&$str< )
if(strtoupper($str)=== $str){ echo 'uppercase letters'; worse worse worse — not more less than uppercase letters";echo checkcase2($str);
//Open source software: phpfensi.com
?>