Check for uppercase character(s) with ctype_upper in PHP

Description

The following code shows how to check for uppercase character(s) with ctype_upper.

Example


//w w w  . j av a2s. c  o  m
<?php
$strings = array('qweqwe139', 'AAAAA', '123123');
foreach ($strings as $testcase) {
    if (ctype_upper($testcase)) {
        echo "The string $testcase consists of all uppercase letters.\n";
    } else {
        echo "The string $testcase does not consist of all uppercase 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