Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
IntlChar::isUUppercase() function in PHP
The IntlChar::isUUppercase() function checks whether the given input character is an Uppercase Unicode character or not.
Syntax
IntlChar::isUUppercase(val)
Parameters
val − It is a character value, which is encoded as a UTF-8 string or Unicode codepoint integer.
Return Value
The IntlChar::isUUppercase() function returns TRUE if the val is an Uppercase Unicode character, FALSE otherwise. Returns NULL if the input is invalid.
Example 1
The following example demonstrates basic usage with different character types ?
<?php
var_dump(IntlChar::isUUppercase("2"));
echo "<br>";
var_dump(IntlChar::isUUppercase("Jack"));
echo "<br>";
var_dump(IntlChar::isUUppercase("K"));
?>
bool(false) NULL bool(true)
Example 2
Let us see another example with special characters and lowercase letters ?
<?php
var_dump(IntlChar::isUUppercase("*"));
echo "<br>";
var_dump(IntlChar::isUUppercase("n"));
echo "<br>";
var_dump(IntlChar::isUUppercase("D"));
?>
bool(false) bool(false) bool(true)
Key Points
- The function only accepts single characters − multi-character strings return NULL
- Numbers and special characters return FALSE
- Only uppercase Unicode letters return TRUE
- The function supports international Unicode uppercase characters
Conclusion
IntlChar::isUUppercase() is useful for validating single uppercase Unicode characters. It returns TRUE only for uppercase letters and FALSE for all other character types including numbers and symbols.
