Saved X
Google login
SignUp with Email
X

How to check for lowercase character in string in php?

theindreshverma ( Added  28 Oct 2021, 06:05 pm )
Login

Php ctype_lower() method check for lowercase character.

<?php
$strings = array('aac123', 'qiutoas', 'QASsdks');
foreach ($strings as $testcase) {
    if (ctype_lower($testcase)) {
        echo "The string $testcase consists of all lowercase letters.\n";
    }
    else {
        echo "The string $testcase does not consist of all lowercase letters.\n";
    }
}
?>

Output

The string aac123 does not consist of all lowercase letters.
The string qiutoas consists of all lowercase letters.
The string QASsdks does not consist of all lowercase letters.

Sourcecode Tags

More Sourcecodes

More Sourcecodes