Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
PHP Function ctype_upper()
Syntax
Definition and Usage
This function checks if all of the characters in the provided string, text, are uppercase characters.
Paramters
Parameter | Description |
text | Required. 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.
|
|
|
|