PHP - Function ctype_upper()


Advertisements


Syntax

ctype_upper ( $text );

Definition and Usage

This function checks if all of the characters in the provided string, text, are uppercase characters.

Parameters

Parameter Description
1

text(Required)

The tested string.

Return Value

It returns TRUE if every character in text is an uppercase letter in the current locale.

Example

Try out following example −

<?php
   $strings = array('test12345', 'ABCEFG');
   
   foreach ($strings as $test) {
      if (ctype_upper($test)) {
         echo "$test consists of all uppercase letters. \n";
      }else {
         echo "$test does not have all uppercase letters. \n";
      }
   }
?> 

This will produce following result −

test12345 does not have all uppercase letters.
ABCEFG consists of all uppercase letters.

php_function_reference.htm

Advertisements