$string='abcasdf';
if (ctype_lower($string)) {
echo " All characters are Lower case only ";
}else{
echo " All characters are not lower case ";
}
The output of above code will be
All characters are Lower case only
Syntax
ctype_upper($input_string);
$string='abc asdf';
if (ctype_lower($string)) {
echo " All characters are Lower case only ";
}else{
echo " Not all characters are lower case ";
}
Output will be
Not all characters are lower case
$string='abc)asdf';
Output will be Not all characters are lower case
$str = array("hello world", "abcdef", "ab#cd","34",442);
foreach ($str as $val){
if (ctype_lower($val)){
echo "<p class='text-success'>The string <b>$val</b> consists of lower Case letters .</p>";
} else {
echo "<p class='text-danger'>The string <b>$val</b> does not consist of all lower case letters.</p>";
}
}
The string hello world does not consist of all lower case letters.
The string abcdef consists of lower Case letters .
The string ab#cd does not consist of all lower case letters.
The string 34 does not consist of all lower case letters.
The string 442 does not consist of all lower case letters.
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.