PHP determines uppercase and lowercase letters function

高洛峰
Release: 2016-11-29 14:50:11
Original
3318 people have browsed it

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

?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!