Copyright © tutorialspoint.com

PHP Function ctype_upper()

previous
Advertisements

Syntax

ctype_upper ( $text );

Definition and Usage

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

Paramters

ParameterDescription
textRequired. The tested string.

Return Value

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

Example

Try out following example:

<?php
$strings = array('AbCd1zyZ9', 'FOOBAR');
foreach ($strings as $testcase) {
 if (ctype_upper($testcase)) {
     echo "$testcase consists of all uppercase letters.<br />";
 } else {
     echo "$testcase does not have all uppercase letters.<br />";
 }
}
?> 

This will produce following result:

AbCd1zyZ9 does not have all uppercase letters.
FOOBAR consists of all uppercase letters.
previous

Copyright © tutorialspoint.com