Check for lowercase character(s) with ctype_lower in PHP

Description

The following code shows how to check for lowercase character(s) with ctype_lower.

Example


/*  ww w  .j av a 2s  .  c  o m*/
<?php
$strings = array('aac123', '234234werfwer', '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";
    }
}
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone