Php case-sensitive letter function. It provides a simple php function for judging uppercase and lowercase letters of a string. it can be used to find the numbers of uppercase letters and lowercase letters of a string. It provides a simple php function for judging uppercase and lowercase letters of a string. it is a convenient and common function.
It provides a simple php example to determine the upper and lower case letters of a string. it is a convenient and common function.
Function checkcase ($ str ){
If (preg_match ('/^ [a-z] + $/', $ str )){
Echo 'lower-case letters ';
} Elseif (preg_match ('/^ [a-z] + $/', $ str )){
Echo 'uppercase letters ';
}
}
Method 2
$ Str = 'a ';
Function checkcase1 ($ str ){
$ Str = ord ($ str );
If ($ str> 64 & $ str <91 ){
Echo 'uppercase letters ';
Return;
}
If ($ str> 96 & $ str <123 ){
Echo 'lower-case letters ';
Return;
}
Echo 'not a letter ';
}
Function checkcase2 ($ str ){
If (strtoupper ($ str) ===$ str ){
Echo 'uppercase letters ';
} Else {
Echo 'lower-case letters ';
}
}
Echo checkcase1 ($ str );
Echo checkcase2 ($ str );
?>
Bytes. Mention...