Friday, October 24, 2025
HomeLanguagesPHP | ctype_lower() Function

PHP | ctype_lower() Function

The ctype_lower() function is an inbuilt function in PHP which is used to check whether the given characters in the string is lower case or not.

Syntax:

bool ctype_lower( string $text )

Parameters: This function accepts single parameter $text which holds the string that need to be tested.

Return Value: This function returns TRUE if all characters of a string is a lowercase character in the current locale.

Below programs illustrate the ctype_lower() function in PHP:

Program 1:




<?php 
  
// PHP program to check the string contains
// all lower case characters or not
$strings = array('gfg123', 'neveropen', 'GfG'); 
  
// Loop to check the above three strings
foreach ($strings as $testcase) { 
    if (ctype_lower($testcase)) { 
        echo "Yes\n"; 
    } else { 
        echo "No\n"; 
    } 
} 
?> 


Output:

No
Yes
No

Program 2:




<?php
  
// Declare a string
$str = "neveropen"; 
  
$n = strlen($str); 
  
$count = 0;
  
for($i = 0; $i < $n; $i++) {
    if(ctype_lower($str[$i])) {
        $count++;
    }
}
  
echo "Totla number of lower case "
     . "character in string: "
     . $count;
?>


Output:

Totla number of lower case character in string: 11

Reference: https://www.php.net/manual/en/function.ctype-lower.php

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS